[erlang-questions] meck

Roberto Ostinelli roberto@REDACTED
Wed Jul 25 07:30:55 CEST 2012


> Hi,
> you are mixing eunit generators with simple test cases. Did you mean this?
>
> get_config_test() ->
>   meck:new(mocked),
>   meck:expect(mocked, myfun, fun(Filename) -> ok end),
>   ?assertEqual(ok, get_config()),
>   ?assert(meck:called(mocked, myfun, ["test.config"])),
>   meck:unload(mocked).
>
> Normally, you should split meck:new and meck:unload to separate
> setup/cleanup functions. Because if a test fails and the module is not
> cleaned, it might unexpectedly do ill for your other test cases.
>

can't i use this in generators?

the reason why i didn't include unload is because of this:
https://github.com/eproxus/meck/issues/72

r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120724/839bd788/attachment.htm>


More information about the erlang-questions mailing list