module Mocha::API

Public Instance Methods

assert_received(mock, expected_method_name) { |matcher| ... } click to toggle source

Asserts that the given mock received the given method.

Examples:

assert_received(mock, :to_s)
assert_received(Radio, :new) {|expect| expect.with(1041) }
assert_received(radio, :volume) {|expect| expect.with(11).twice }
# File lib/bourne/api.rb, line 13
def assert_received(mock, expected_method_name)
  matcher = have_received(expected_method_name)
  yield(matcher) if block_given?
  assert matcher.matches?(mock), matcher.failure_message
end
should have_received(method).with(arguments).times(times) click to toggle source

Ensures that the given mock received the given method.

Examples:

mock.should have_received(:to_s)
Radio.should have_received(:new).with(1041)
radio.should have_received(:volume).with(11).twice
# File lib/bourne/api.rb, line 100
def have_received(expected_method_name)
  HaveReceived.new(expected_method_name)
end