ex_meck v0.3.0 ExMeck
A mocking library particularly suitable for stateful property based testing.
See test/ex_meck_test.ex for example usage.
Link to this section Summary
Functions
As contains?/3 but returns {:error, :no_match} when no match was found or {:ok, match} with the match.
Verify wheter the history of the mocked module mod contains a call that satisfies specification spec.
Deletes the expectation created with expect/3
Define a mocked function we expect to be called in the test.
Create a new mocked module.
Reset the history of module mod.
Stop all mocked modules.
Stop mocking the module.
Link to this section Functions
contains(m, spec, timeout \\ 1000, times \\ 1)
As contains?/3 but returns {:error, :no_match} when no match was found or {:ok, match} with the match.
This is useful when the match is used for further validation.
contains?(m, spec, timeout \\ 1000, times \\ 1)
Verify wheter the history of the mocked module mod contains a call that satisfies specification spec.
The specification is a nested tuple with the form {p, {m,f,a}, r} where p is the pid of the caller m is the module f is function a is a list of arguments r is the result.
The atom :_ can be used as a don't care value.
delete(mod, fun, arity)
Deletes the expectation created with expect/3
expect(mod, fun, expectation)
Define a mocked function we expect to be called in the test.
new(mod, opts \\ [])
Create a new mocked module.
reset(mod)
Reset the history of module mod.
unload()
Stop all mocked modules.
unload(mod)
Stop mocking the module.