double v0.3.0 Double

Double builds on-the-fly injectable dependencies for your tests. It does NOT override behavior of existing modules or functions.

Summary

Functions

Adds a stubbed function to the given map, struct, or module. Structs will fail if they are missing the key given for function_name. Modules will fail if the function is not defined

Returns a map that can be used to setup stubbed functions

Same as double/0 but can return structs and modules too

Types

double_option()
double_option() :: {:verify, true | false}
option()
option ::
  {:with, [...]} |
  {:returns, any} |
  {:raises, String.t | {atom, String.t}}

Functions

allow(dbl, function_name, opts)
allow(map | struct | atom, atom, [option]) ::
  map |
  struct

Adds a stubbed function to the given map, struct, or module. Structs will fail if they are missing the key given for function_name. Modules will fail if the function is not defined.

double()
double() :: map :: atom

Returns a map that can be used to setup stubbed functions.

double(source, opts \\ [verify: true])
double(map | struct | atom, opts :: double_option) ::
  map |
  struct |
  atom

Same as double/0 but can return structs and modules too