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