test/unit/mock_test.rb in mocha-0.10.1 vs test/unit/mock_test.rb in mocha-0.10.2
- old
+ new
@@ -25,11 +25,11 @@
def test_should_not_stub_everything_by_default
mock = Mock.new
assert_equal false, mock.everything_stubbed
end
-
+
def test_should_stub_everything
mock = Mock.new
mock.stub_everything
assert_equal true, mock.everything_stubbed
end
@@ -296,7 +296,14 @@
mock = Mock.new
mock.stub_everything
assert mock.respond_to?(:abc)
assert mock.respond_to?(:xyz)
end
-
-end
\ No newline at end of file
+
+ def test_should_remove_expectation_for_unstubbed_method
+ mock = Mock.new
+ mock.expects(:method1)
+ mock.unstub(:method1)
+ e = assert_raises(ExpectationError) { mock.method1 }
+ assert_match(/unexpected invocation/, e.message)
+ end
+end