Class: RSpec::Mocks::AnyInstance::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/mocks/any_instance/proxy.rb

Overview

The AnyInstance::Recorder is responsible for redefining the klass's instance method in order to add any stubs/expectations the first time the method is called. It's not capable of updating a stub on an instance that's already been previously stubbed (either directly, or via any_instance).

This proxy sits in front of the recorder and delegates both to it and to the RSpec::Mocks::Proxy for each already mocked or stubbed instance of the class, in order to propogates changes to the instances.

Note that unlike RSpec::Mocks::Proxy, this proxy class is stateless and is not persisted in RSpec::Mocks.space.

Proxying for the message expectation fluent interface (typically chained off of the return value of one of these methods) is provided by the FluentInterfaceProxy class below.