Module: Mocha::ClassMethods
- Defined in:
- lib/mocha/class_methods.rb
Overview
Methods added to all classes to allow mocking and stubbing on real (i.e. non-mock) objects.
Instance Method Summary collapse
-
#any_instance ⇒ Mock
A mock object which will detect calls to any instance of this class.
Instance Method Details
#any_instance ⇒ Mock
Returns a mock object which will detect calls to any instance of this class.
45 46 47 48 49 50 |
# File 'lib/mocha/class_methods.rb', line 45 def any_instance if frozen? raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}.any_instance", caller) end @any_instance ||= AnyInstance.new(self) end |