Closed tielur closed 6 years ago
Mox.defmock only defines the mock. Unless you are defining the mock with the name of an existing module, it should not affect your application at all. But not the Application.put_env call is global, so if you change it, you need to remember to revert its value back.
That makes sense, thanks José
Is there a way to use a Mock for only some tests?
I've seen the suggestion of calling
Mox.defmock
andApplication.put_env
in thetest_helper.exs
.My problem is that I want to mock my behavior for some tests but when I test the actual implementation of the behavior I don't want to mock it.
I've tried moving the
Mox.defmock
andApplication.put_env
into asetup
block for specific tests but it seems like callingMox.defmock
anywhere causes all tests to use the mock?