View Source EfxCase.Mock (Efx v0.1.5)

Internal logic of a mocked behaviour. This module is meant to make handling a mock, counting the calls, finding the right mocked function, calling the mocked function, etc... more convenient.

A mock consists of the following:

  • a list of mocked functions

Summary

Types

@type t() :: %EfxCase.Mock{mocked_funs: [EfxCase.Mock.MockedFun.t()] | nil}

Functions

Link to this function

add_fun(mock, name, arity, impl, exptected_calls \\ nil)

View Source
@spec add_fun(
  t(),
  atom(),
  arity(),
  (... -> any()) | :default | :unmocked,
  non_neg_integer() | nil
) ::
  {:ok, t()} | {:error, :function_not_in_mock}
Link to this function

get_fun(mock, name, arity)

View Source
@spec get_fun(t(), atom(), arity()) ::
  no_return() | (... -> any()) | :default | :unmocked
@spec get_unsatisfied(t()) :: [EfxCase.Mock.MockedFun.t()]
Link to this function

inc_called(mock, name, arity)

View Source
@spec inc_called(t(), atom(), arity()) :: t()
@spec make(module()) :: t()