Skip to content

Instantly share code, notes, and snippets.

@bodhi
Created May 27, 2010 03:59
Show Gist options
  • Save bodhi/415440 to your computer and use it in GitHub Desktop.
Save bodhi/415440 to your computer and use it in GitHub Desktop.
pasokun:myasics bodhi$ ruby -Itest test/m_test.rb
Loaded suite test/m_test
Started
..E
Finished in 0.002001 seconds.
1) Error:
test_mock_should_fail(MTest):
Mocha::ExpectationError: unexpected invocation: #<Object:0x109c3fc30>.to_s()
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Object:0x109c43678>.to_s(any_parameters)
satisfied expectations:
- expected exactly once, already invoked once: #<Object:0x109c41a08>.to_s(any_parameters)
- expected exactly once, already invoked once: #<Object:0x109c3fc30>.to_s(any_parameters)
test/m_test.rb:16:in `test_mock_should_fail'
3 tests, 0 assertions, 0 failures, 1 errors
require "test_helper"
class MTest < Test::Unit::TestCase
def setup
@o = Object.new
@o.expects(:to_s).once
end
def test_mock_good
@o.to_s
end
def test_mock_should_fail
@o.to_s
@o.to_s
end
def test_mock_doesnt_fail
@o.object_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment