Last active
August 29, 2015 14:21
-
-
Save chriskottom/b9a73eaffb2c5b5b6676 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
class MinitestMockTest < Minitest::Test | |
def test_method_called_more_times_than_expected | |
mock = Minitest::Mock.new | |
3.times { mock.expect :some_method, true } | |
assert mock.some_method # OK | |
assert mock.some_method # OK | |
assert mock.some_method # still OK | |
assert mock.some_method # MockExpectationError | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby minitest_mock_test.rb | |
Run options: --seed 25695 | |
# Running: | |
E | |
Finished in 0.000932s, 1072.6138 runs/s, 3217.8414 assertions/s. | |
1) Error: | |
MinitestMockTest#test_method_called_more_times_than_expected: | |
MockExpectationError: No more expects available for :some_method: [] | |
minitest_mock_test.rb:11:in `test_method_called_more_times_than_expected' | |
1 runs, 3 assertions, 0 failures, 1 errors, 0 skips |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment