Class: RSpec::Forward::ForwardToScope

Inherits:
Object
  • Object
show all
Includes:
Mocks::ExampleMethods, ForwardScopeMethods, ForwardScopeParentMethods
Defined in:
lib/rspec/forward/forward_to_scope.rb

Instance Method Summary collapse

Methods included from ForwardScopeParentMethods

#using_class_name, #using_method, #using_method_args, #with_parent_arg

Methods included from ForwardScopeMethods

#exp_args, #failure_message, #failure_message_when_negated, #failure_scope_klass_name_not_defined, #find_actual, included, #matches_for?

Constructor Details

#initialize(expected) ⇒ ForwardToScope

Returns a new instance of ForwardToScope.



8
9
10
11
12
13
# File 'lib/rspec/forward/forward_to_scope.rb', line 8

def initialize(expected)
  @expected = expected
  @kwargs ||= {}
  @args ||= []
  @target_method_name ||= :call
end

Instance Method Details

#descriptionObject



19
20
21
22
23
24
# File 'lib/rspec/forward/forward_to_scope.rb', line 19

def description
  <<~TXT.gsub(/\n+/, " ")
    to pass the arguments to the constructor of instance and return
    the value returned by the instance method
  TXT
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rspec/forward/forward_to_scope.rb', line 15

def matches?(actual)
  matches_for?(actual)
end