samedi 23 mai 2015

How do I test a module when the behaviour depends on Application.get_env/3?

I'm making a library with a module that when use'd injects some functions dependant on the contents of a directory, and I want to test the behaviour with different directories. Currently I get the path to the directory through application config with Application.get_env/3.

If I'm changing the directory Application.put_env/4 it means my tests have to run sequentially as this is effective a global value, correct?

Can I stub out the call to Application.get_env/3? Or should I be passing in the value in another way? (such as via the use macro)

Aucun commentaire:

Enregistrer un commentaire