Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c1046268f4
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (32 sloc) 0.775 kb
require 'rspec/mocks/any_instance/chain'
require 'rspec/mocks/any_instance/message_chains'
require 'rspec/mocks/any_instance/recorder'
module RSpec
module Mocks
module AnyInstance
# Use this to set stubs and expectations on any instance
# of a given class.
#
# @example
#
# Thing.any_instance.should_receive(:go)
# Thing.new.go
def any_instance
RSpec::Mocks::space.add(self)
__recorder
end
# @private
def rspec_verify
__recorder.verify
super
ensure
__recorder.stop_all_observation!
@__recorder = nil
end
# @private
def __recorder
@__recorder ||= AnyInstance::Recorder.new(self)
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.