ex_meck v0.1.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

Verify wheter the history of the mocked module mod contains a call that satisfies specification spec

Define a mocked function we expect to be called in the test

Create a new mocked module

Reset the history of module mod

Stop mocking the module

Link to this section Functions

Link to this function contains?(mod, spec, timeout \\ 1000)

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.

Link to this function expect(mod, fun, expectation)

Define a mocked function we expect to be called in the test.

Link to this function new(mod, opts \\ [])

Create a new mocked module.

Reset the history of module mod.

Stop mocking the module.