View Source Jex.GenerateBehaviour (Jex v0.1.0)

Turns the current module into a behaviour based on the specs of publicly defined functions.

This is useful in cases where you only have one implementation, but want to use mox to create a mock that you can resolve to in your test environment.

example

Example

defmodule Greeter do
  use Jex.GenerateBehaviour

  @spec hello :: String.t()
  def hello(), do: "Hello!"
end

Mox.defmock(GreeterMock, for: Greeter)