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

  • Object
show all
Defined in:


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

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.