Class: Mocha::TerseObjectStub
- Defined in:
- lib/mocha/shot/terse_object_stub.rb
Instance Method Summary collapse
-
#initialize(object) ⇒ TerseObjectStub
constructor
A new instance of TerseObjectStub.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(object) ⇒ TerseObjectStub
Returns a new instance of TerseObjectStub.
3 4 5 |
# File 'lib/mocha/shot/terse_object_stub.rb', line 3 def initialize(object) @object = object end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/mocha/shot/terse_object_stub.rb', line 7 def method_missing(method_name, *args, &block) if block @object.__stubs__(method_name).with(*args).returns(block) else @object.__stubs__(method_name).with(*args) end end |