View Source Jex.Resolver behaviour (Jex v0.1.0)

The resolver behaviour and default implementation.

example

Example

defmodule MyApp.MockResolver do
  use Jex.Resolver

  @mocks %{
    Greeter => GreeterMock,
    Cart => CartMock
  }

  for {target, mock} <- @mocks do
    Mox.defmock(mock, for: target)
  end

  @impl Jex.Resolver
  def resolve(target), do: @mocks[target] || target
end

Link to this section Summary

Callbacks

Determines what module should be injected into a caller.

Functions

The default behaviour simply resolves to the original target of the alias.

Link to this section Callbacks

@callback resolve(atom()) :: atom()

Determines what module should be injected into a caller.

Recieves the module that was the original target of an alias and should return another module that implements the same interface.

Link to this section Functions

@spec resolve(atom()) :: atom()

The default behaviour simply resolves to the original target of the alias.