View Source Moxable (Moxable v0.1.0)
Moxable is a simplified method for working with Mox in an Elixir project.
setup
Setup
Add use Moxable
to any module you want to use Mox with in testing and define a behaviour
for your module. use Mockable
takes two options:
{:behaviour, behaviour_name}
: override the default behaviour name (by default Moxable will use<YOUR_MODULE_NAME>.Behaviour
){:dev_impl, dev_module}
: override the module that will be used in the:dev
context
usage
Usage
Anywhere you will be calling or expect
ing mocked functions of your Moxable'd module,
use
it to define a dynamic alias to the real, mocked or dev version of the module based
on the current context. :as
may be supplied as an option to override the alias name.