Skip to content

Commit

Permalink
Verify that history/2 returns the events in the correct order.
Browse files Browse the repository at this point in the history
  • Loading branch information
daha committed Oct 12, 2011
1 parent 5dd556e commit 0bf3195
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/meck_tests.erl
Expand Up @@ -282,18 +282,20 @@ history_meck_error_(Mod) ->
meck:history(Mod)).

history_by_pid_(Mod) ->
ok = meck:expect(Mod, test, fun() -> ok end),
ok = meck:expect(Mod, test1, fun() -> ok end),
ok = meck:expect(Mod, test2, fun() -> ok end),

TestPid = self(),
Fun = fun() ->
Mod:test(),
Mod:test1(),
TestPid ! {self(), done}
end,
Pid = spawn(Fun),
Mod:test(),
Mod:test(),
?assertEqual([{Pid, {Mod, test, []}, ok}], meck:history(Mod, Pid)),
?assertEqual([{TestPid, {Mod, test, []}, ok},
{TestPid, {Mod, test, []}, ok}], meck:history(Mod, TestPid)),
Mod:test1(),
Mod:test2(),
?assertEqual([{Pid, {Mod, test1, []}, ok}], meck:history(Mod, Pid)),
?assertEqual([{TestPid, {Mod, test1, []}, ok},
{TestPid, {Mod, test2, []}, ok}], meck:history(Mod, TestPid)),
?assertEqual(meck:history(Mod), meck:history(Mod, '_')).

shortcut_expect_(Mod) ->
Expand Down

0 comments on commit 0bf3195

Please sign in to comment.