Class: Mocha::TerseMock
Instance Method Summary collapse
-
#initialize(mock, backtrace) ⇒ TerseMock
constructor
A new instance of TerseMock.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(mock, backtrace) ⇒ TerseMock
Returns a new instance of TerseMock.
3 4 5 6 |
# File 'lib/mocha/shot/terse_mock.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_mock.rb', line 8 def method_missing(method_name, *args, &block) if block @mock.__expects__(method_name, @backtrace).with(*args).returns(block) else @mock.__expects__(method_name, @backtrace).with(*args) end end |