Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #454. I believe this test was intended to refer to the exception [1] raised in `Mockery#verify` i.e. ExpectationError [2] when using Test::Unit and MiniTest::Assertion [3] when using MiniTest. When an unexpected invocation is received by a mock object, it raises the same type of exception (see Mock#raise_unexpected_invocation_error [4]). Thus the scenario for an unexpected invocation earlier in the same test case gives us some related coverage. I believe the reason why we don't want the exception class to be rescued by a standard `rescue` is that the code under test could legitimately include such a rescue block. If the Mocha-generated exception was rescued by the code under test, the test failure might be swallowed or a confusing error message might be displayed. It's much less legitimate for code under test to rescue `Exception` and so it's preferable if the Mocha-generated exception is a direct subclass of `Exception` and not `StandardError`. Having said all that the test in question is not really testing anything useful that isn't tested elsewhere. [1]: https://github.com/freerange/mocha/blob/8751dcbda08650a339932d86c9f24d076c167300/lib/mocha/mockery.rb#L93 [2]: https://github.com/freerange/mocha/blob/8751dcbda08650a339932d86c9f24d076c167300/lib/mocha/expectation_error.rb#L7) [3]: https://github.com/freerange/mocha/blob/8751dcbda08650a339932d86c9f24d076c167300/lib/mocha/integration/mini_test/adapter.rb#L26 [4]: https://github.com/freerange/mocha/blob/8751dcbda08650a339932d86c9f24d076c167300/lib/mocha/mock.rb#L380)
- Loading branch information