dashbitco / mox

Mocks and explicit contracts in Elixir
1.35k stars 77 forks source link

Documentation for 0.1.0 missing Registry.start_link #12

Closed idlehands closed 7 years ago

idlehands commented 7 years ago

Sorry... I know that the package is moving to a GenServer from Registry, but trying the currently published version, 0.1.0, late at night left me scratching my head until I realized that I needed to start the Registry entry for Mox. I would have done this as a PR, as my understanding is that documentation can be updated after the fact on hex, but a) I wasn't sure how to make the PR to an old version and b) I wasn't sure of the best place to make the start link call. I am currently doing it in

test_helper.exs:

Registry.start_link(:unique, Mox)

c) I wasn't sure if :unique was actually the right call.

I'm not sure how long it will be until the GenServer version goes out, but if someone can point me in the right direction, I would like to help clarify this.

Thanks!

josevalim commented 7 years ago

You do not have to do that. Instead you need to make sure the Mox application is started. The README says:

Mox should be automatically started unless the :applications key is set inside def application in your mix.exs. In such cases, you need to remove the :applications key in favor of :extra_applications or call Application.ensure_all_started(:mox) in your test/test_helper.exs.

idlehands commented 7 years ago

Sorry about that.

josevalim commented 7 years ago

No problem. :D