123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::AnyInstance::StubChain Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RSpec::Mocks::AnyInstance::ExpectChainChain, RSpec::Mocks::AnyInstance::StubChainChain
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Chain
Instance Chain:
Inherits: RSpec::Mocks::AnyInstance::Chain
Defined in: rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb

Constant Summary

Class Method Summary

Chain - Inherited

Instance Attribute Summary

Chain - Inherited

Instance Method Summary

Chain - Inherited

Chain::Customizations - Included

#and_call_original

Records the and_call_original message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#and_raise

Records the and_raise message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#and_return

Records the and_return message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#and_throw

Records the and_throw message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#and_wrap_original

Records the and_wrap_original message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#and_yield

Records the and_yield message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#at_least

Records the at_least message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#at_most

Records the at_most message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#exactly

Records the exactly message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#never

Records the never message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#once

Records the once message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#thrice

Records the thrice message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#time

Records the time message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#times

Records the times message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#twice

Records the twice message for playback against an instance that invokes a method stubbed or mocked using any_instance.

#with

Records the with message for playback against an instance that invokes a method stubbed or mocked using any_instance.

Instance Attribute Details

#expectation_fulfilled?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb', line 7

def expectation_fulfilled?
  true
end

Instance Method Details

#create_message_expectation_on(instance) (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb', line 13

def create_message_expectation_on(instance)
  proxy = ::RSpec::Mocks.space.proxy_for(instance)
  method_name, opts = @expectation_args
  opts = (opts || {}).merge(:expected_form => IGNORED_BACKTRACE_LINE)

  stub = proxy.add_stub(method_name, opts, &@expectation_block)
  @recorder.stubs[stub.message] << stub

  if RSpec::Mocks.configuration.yield_receiver_to_any_instance_implementation_blocks?
    stub.and_yield_receiver_to_implementation
  end

  stub
end

#invocation_order (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb', line 40

def invocation_order
  InvocationOrder
end

#verify_invocation_order(rspec_method_name, *_args, &_block) (private)

Raises:

  • (NoMethodError)
[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb', line 44

def verify_invocation_order(rspec_method_name, *_args, &_block)
  return if invocation_order.fetch(rspec_method_name, [nil]).include?(last_message)
  raise NoMethodError, "Undefined method #{rspec_method_name}"
end