Closed kelostrada closed 5 years ago
Seeing how all the tests in mock_setup_test.exs
pass, it looks pretty safe to me as well.
Thanks for your contribution!
@Olshansk This PR fixes an issue that we're experiencing. Can you please make a release with this fix? Thanks a lot!
Done!
When running tests using
setup_with_mock
the mocks aren't actually unloaded fast enough (or maybe not at all) and sometimes they pass through to other tests (which don't want the mocks to be active at all). All the tests I did were onasync: false
and this still happened. Then I noticed you don't unload explicitly the mocks so hence the PR. I unload the mocks globally using:meck.unload()
but I figure you don't want to use the mocks in different tests (setting them in one test and unloading in different) as the loading/unloading is indeterministic. I'm convinced it's pretty safe to unload all the mocks at the end of the test every time the test is finished. This happens in ExUnit'son_exit
.