Pact
A module for managing dependencies in your application. You can set, get, and override dependencies globally or per-pid.
Example
Pact.start
Pact.put(:http, HTTPoison)
Pact.get(:http).get("https://google.com")
# You can also override per module
Pact.override(self, :http, FakeHTTP)
spawn(fn ->
Pact.get(:http).get("https://google.com") # Calls HTTPoison
end)
Pact.get(:http).get("https://google.com") # Calls FakeHTTP
Summary↑
get(name) | Gets the dependency with |
override(pid, name, module) | Override all calls to |
put(name, module) | Assign |
start(initial_modules \\ %{}) | |
stop() | Stop Pact |
Functions
Gets the dependency with name
Override all calls to name
in pid
with module
Assign module
to the key name
Stop Pact