Detour (detour v0.2.0)
Link to this section Summary
Functions
Returns the detour struct associated with the current process.
Starts a Detour server.
Stops a running Detour server.
Link to this section Types
message_t()
Specs
Specs
t() :: %Detour{pid: pid() | nil, port: pos_integer()}
Link to this section Functions
get()
Specs
get() :: t()
Returns the detour struct associated with the current process.
open(opts \\ [])
Specs
Starts a Detour server.
You can specify a port by providing a value to the :port option. If a port
isn't provided then a random open port will be used. Note that it is
preferrable to have Detour assign a port for you. When assigning a static port
you run into the risk of address conflicts and limits your ability to run
tests asynchronously.
Returns a %Detour{} struct that will contain the assigned port. You can pass
this port to your SMTP client with a relay of localhost to direct all SMTP
traffic to Detour.
shutdown(detour, opts \\ [])
Specs
Stops a running Detour server.
Stopping a Detour server will release it's port making it available for
another process. When providing a port to open/1 it's important to perform
a shutdown, otherwise test processes using the same port can conflict.