I have unit tests and integration tests
Both call the same set of functions.
All the integration tests passed. 🎉
All the unit tests failed. 😢
For every unit test , I got the same error :
module not available pointed to solutions that were not
applicable. Most suggested including
mix.exs - which was
already taken care of.
I'm grateful for the people on the elixir forum for being helpful and responsive. (You can read the details on elixir forum. Link at the end.)
I am using
Mock library in the unit tests. It turns out it changes what is
available to the underlying code (as it should).
I was using
HTTPoison.post in the unit tests, while one of the lower level
function was calling
The fix was as simple as changing
HTTPoison.request in the
with_mock HTTPoison block.
Reference : See the discussion on Elixir Forum