Promox.stub
You're seeing just the function
stub
, go back to Promox module for more information.
Link to this function
stub(mock, protocol, name, code)
Allows the protocol.name
callback with arity given by code
to be invoked with mock
any times.
The call would be delegated to code
and returns whatever code
returns.
Caveat
- The first argument passed to
code
is always themock
being stubbed. stub/4
will overwrite any previous calls tostub/4
- If expectations and stubs are defined for the same function and arity, the stub is invoked only after all expectations are fulfilled.
Examples
To allow MyProtocol.callback/1
to be called any times:
my_mock =
Promox.new()
|> Promox.stub(MyProtocol, :callback, fn _mock -> :ok end)