Class: RSpec::Forward::ForwardToInstance
- Inherits:
-
Object
- Object
- RSpec::Forward::ForwardToInstance
- Includes:
- Mocks::ExampleMethods, ForwardMethods
- Defined in:
- lib/rspec/forward/forward_to_instance.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(expected) ⇒ ForwardToInstance
constructor
A new instance of ForwardToInstance.
- #matches?(actual) ⇒ Boolean
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) ⇒ ForwardToInstance
Returns a new instance of ForwardToInstance.
7 8 9 10 11 |
# File 'lib/rspec/forward/forward_to_instance.rb', line 7 def initialize(expected) @expected = expected @kwargs ||= {} @args ||= [] end |
Instance Method Details
#description ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rspec/forward/forward_to_instance.rb', line 17 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
13 14 15 |
# File 'lib/rspec/forward/forward_to_instance.rb', line 13 def matches?(actual) matches_for?(actual, :return) end |