Object
Allows to specify a block to execute when expectation will be matched. This way, we can specify dynamic values to return or just make some side effects
Example:
foo.expects(:bar).with('bla').calls { 2 + 3 } foo.bar('bla') # => 5
# File lib/debugger/test/mocha_extensions.rb, line 12 def calls(&block) @calls ||= Call.new @calls += Call.new(block) self end
# File lib/debugger/test/mocha_extensions.rb, line 18 def invoke_with_calls(arguments, &block) invoke_without_calls(&block) || (@calls.next(arguments, &block) if @calls) end
Generated with the Darkfish Rdoc Generator 2.