require 'minitest/autorun'
require 'minitest/fire_mock'
class MyClass
end
class MyClassTest < MiniTest::Test
# this test fails
def test_something
mock = MiniTest::FireMock.new('MyClass')
mock.expect(:doesnt_exist, 42)
assert_equal 42, mock.doesnt_exist
end
# this test should fail, but doesn't
def test_something_else
mock = MiniTest::FireMock.new(MyClass)
mock.expect(:doesnt_exist, 42)
assert_equal 42, mock.doesnt_exist
end
end
and then I run:
$ ruby test_my_class.rb
Run options: --seed 28129
# Running:
E.
Finished in 0.000804s, 2487.5159 runs/s, 1243.7579 assertions/s.
1) Error:
MyClassTest#test_something:
MockExpectationError: expected MyClass to define `doesnt_exist`, but it doesn't
test_my_class.rb:11:in `test_something'
2 runs, 1 assertions, 0 failures, 1 errors, 0 skips
The first test fails, but the second one doesn't. Is this behavior intended? If not, would you accept a PR to fix this?
If I have
test_my_class.rb
:and then I run:
The first test fails, but the second one doesn't. Is this behavior intended? If not, would you accept a PR to fix this?
Thanks!