When using mocks in Elixir, particularly with Mox then the standard way of loading the implementation is along the lines of Application.get_env(:cat_facts, CatFacts.CatFactsApi, CatFacts.RealCatFactsApi)
. In this post I suggest an alternative which is a little less flexible, but also safer and avoid extra configuration.
5 Likes