Patch.Mock.Server (patch v0.8.0) View Source
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.
Link to this section Types
Specs
option() :: Patch.Mock.option()
Sum-type of all valid options
Specs
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
.
Specs
Delegates a call to a mocked module through the server so it can optionally respond with a mock value.
Specs
expose(module :: module(), exposes :: Patch.Mock.exposes()) :: :ok | {:error, term()}
Specs
history(module :: module()) :: Patch.Mock.History.t()
Retrieves the call history for a mock
Specs
Callback implementation for GenServer.init/1
.
Specs
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.
Specs
restore(module :: module()) :: :ok
Restores a module to its original state.
Specs
start_link(module :: module(), options :: [Patch.Mock.Code.option() | option()]) :: {:ok, pid()} | {:error, {:already_started, pid()}}