Module: Mocha::ClassMethods
- Included in:
- Class
- Defined in:
- lib/mocha/object.rb
Overview
Methods added to all classes to allow mocking and stubbing on real (i.e. non-mock) objects.
Defined Under Namespace
Classes: AnyInstance
Instance Method Summary collapse
-
#any_instance ⇒ Mock
A mock object which will detect calls to any instance of this class.
- #stubba_method ⇒ Object
Instance Method Details
#any_instance ⇒ Mock
Returns a mock object which will detect calls to any instance of this class.
231 232 233 234 235 236 |
# File 'lib/mocha/object.rb', line 231 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 |
#stubba_method ⇒ Object
188 189 190 |
# File 'lib/mocha/object.rb', line 188 def stubba_method Mocha::ClassMethod end |