Hey,
I’m really struggling to work this out, so I hope somebody can help.
I’ve got a PubSub module that can be sent messages through:
GenServer.cast :module, {:publish, %Event{}}
What it publishes too, can be configured through application config:
subscribers = Application.get_env :app, :subscribers, []
I’m trying to test that if the config contains ASubscriber
, that ASubscriber
actually receives a publish
call.
I’ve tried many variations of assert_receive
, but none seem to work. I’m not even sure when / how to load Application.get
in the module (I’ve currently got it inside start_link
) or how to provide Application.get_env
for test.
If anyone has any suggestions, I’d love to hear them!
Thanks,
David