Class: RSpec::Forward::ForwardToInstanceBuild

Inherits:
Object
  • Object
show all
Includes:
Mocks::ExampleMethods, ForwardMethods
Defined in:
lib/rspec/forward/forward_to_instance_build.rb

Instance Method Summary collapse

Methods included from ForwardMethods

#assign_actual, #exp_args, #failure_message, #failure_message_when_negated, included, #instance, #matches_for?, #with, #with_1_arg, #with_1_arg_and_named, #with_named, #with_no_args

Constructor Details

#initialize(expected) ⇒ ForwardToInstanceBuild

Returns a new instance of ForwardToInstanceBuild.



7
8
9
10
11
# File 'lib/rspec/forward/forward_to_instance_build.rb', line 7

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

Instance Method Details

#descriptionObject



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

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/rspec/forward/forward_to_instance_build.rb', line 13

def matches?(actual)
  assign_actual(actual)

  matches_for?(actual, instance)
end