mercredi 23 septembre 2015

Can someone provide an example of how to mock directory list in Elixir?

In Python you can do something like this, usually for unit testing:

>>> import os
>>> from mock import MagicMock
>>> os.listdir = MagicMock(return_value=['file1.txt', 'file2.txt', 'file3.txt'])
>>> os.listdir('./test')
['file1.txt', 'file2.txt', 'file3.txt']

How do you achieve the same thing in Elixir ?

Aucun commentaire:

Enregistrer un commentaire