View Source nuntius_mocker (nuntius v0.0.3)

Link to this section Summary

Functions

Reregisters the mocked process with its name, thus removing the mock.
Removes an expect function.
Adds a new expect function to a mocked process.
Returns the list of expect functions for a process.
Returns the history of messages received by a mocked process.
Returns the PID of the currently mocked process.
Returns the PID of a mocked process (the original one with that name).
Passes the current message down to the mocked process.
Passes a message down to the mocked process.
Returns whether a particular message was received already.
Erases the history for a mocked process. Note that there is no gen:cast(...), gen_server and others basically just send the message and move on, like us.
Boots up a mocking process. If the process to be mocked doesn't exist, returns
ignore
.

Link to this section Functions

-spec delete(nuntius:process_name()) -> ok.
Reregisters the mocked process with its name, thus removing the mock.
Link to this function

delete(ProcessName, ExpectId)

View Source
-spec delete(nuntius:process_name(), nuntius:expect_id()) -> ok.
Removes an expect function.
Link to this function

expect(ProcessName, ExpectId, Function)

View Source
Adds a new expect function to a mocked process.
-spec expects(nuntius:process_name()) -> {ok, #{nuntius:expect_id() => nuntius:expect_fun()}}.
Returns the list of expect functions for a process.
-spec history(nuntius:process_name()) -> [nuntius:event()].
Returns the history of messages received by a mocked process.
Link to this function

init(ProcessName, ProcessPid, Opts)

View Source
-spec init(nuntius:process_name(), pid(), nuntius:opts()) -> no_return().
-spec mocked_process() -> pid().
Returns the PID of the currently mocked process.
Link to this function

mocked_process(ProcessName)

View Source
-spec mocked_process(nuntius:process_name()) -> pid().
Returns the PID of a mocked process (the original one with that name).
-spec passthrough() -> ok.
Passes the current message down to the mocked process.
-spec passthrough(term()) -> ok.
Passes a message down to the mocked process.
Link to this function

received(ProcessName, Message)

View Source
-spec received(nuntius:process_name(), term()) -> boolean().
Returns whether a particular message was received already.
Link to this function

reset_history(ProcessName)

View Source
-spec reset_history(nuntius:process_name()) -> ok.
Erases the history for a mocked process. Note that there is no gen:cast(...), gen_server and others basically just send the message and move on, like us.
Link to this function

start_link(ProcessName, Opts)

View Source
-spec start_link(nuntius:process_name(), nuntius:opts()) -> {ok, pid()} | ignore.
Boots up a mocking process. If the process to be mocked doesn't exist, returns
ignore
.