@private
# File lib/rspec/mocks/any_instance.rb, line 40 40: def __recorder 41: @__recorder ||= AnyInstance::Recorder.new(self) 42: end
Used to set stubs and message expectations on any instance of a given class. Returns a [Recorder](Recorder), which records messages like `stub` and `should_receive` for later playback on instances of the class.
@example
Car.any_instance.should_receive(:go) race = Race.new race.cars << Car.new race.go # assuming this delegates to all of its cars # this example would pass Account.any_instance.stub(:balance) { Money.new(:USD, 25) } Account.new.balance # => Money.new(:USD, 25))
@return [Recorder]
# File lib/rspec/mocks/any_instance.rb, line 25 25: def any_instance 26: RSpec::Mocks::space.add(self) 27: __recorder 28: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.