Parent

Mocha::Expectation

Public Instance Methods

calls(&block) click to toggle source

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
invoke(arguments, &block) click to toggle source
Also aliased as: invoke_without_calls
Alias for: invoke_with_calls
invoke_with_calls(arguments, &block) click to toggle source
# 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
Also aliased as: invoke
invoke_without_calls(arguments, &block) click to toggle source
Alias for: invoke

[Validate]

Generated with the Darkfish Rdoc Generator 2.