View Source Patch.Mock.Server (patch v0.14.0)
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Delegates a call to a mocked module through the server so it can optionally respond with a mock value.
Retrieves the call history for a mock
Callback implementation for GenServer.init/1
.
Registers a mock value to be returned whenever the specified function is called on the module.
Restores a module to its original state.
Restores a function in a module to its original state
Link to this section Types
@type option() :: Patch.Mock.option()
Sum-type of all valid options
@type t() :: %Patch.Mock.Server{ history: Patch.Mock.History.t(), mocks: %{required(atom()) => term()}, module: module(), options: [Patch.Mock.Code.option()], unit: Patch.Mock.Code.Unit.t() }
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Delegates a call to a mocked module through the server so it can optionally respond with a mock value.
@spec expose(module :: module(), exposes :: Patch.Mock.exposes()) :: :ok | {:error, term()}
@spec history(module :: module()) :: Patch.Mock.History.t()
Retrieves the call history for a mock
Callback implementation for GenServer.init/1
.
@spec register(module :: module(), name :: atom(), value :: Patch.Mock.Value.t()) :: :ok
Registers a mock value to be returned whenever the specified function is called on the module.
@spec restore(module :: module()) :: :ok
Restores a module to its original state.
Restores a function in a module to its original state
@spec start_link(module :: module(), options :: [Patch.Mock.Code.option() | option()]) :: {:ok, pid()} | {:error, {:already_started, pid()}}