freerange / mocha

A mocking and stubbing library for Ruby
https://mocha.jamesmead.org
Other
1.23k stars 158 forks source link

Include the original test name in expired stub error messages #644

Closed floehopper closed 7 months ago

floehopper commented 7 months ago

Based on #641 and thanks to @casperisfine.

It is currently very hard to track down such leaked stubs, when they happen, as they might be created in one test and cause an exception dozens of tests later.

By including the name of the test that invalidated them, it makes the debugging process a bit easier.

Note, I made setup also accept the current test instance purely for consistency with teardown but it's not strictly necessary.

floehopper commented 7 months ago

Released in v2.2.0