diff --git a/lib/tesla/mock.ex b/lib/tesla/mock.ex index 58a36d6a..5aea1371 100644 --- a/lib/tesla/mock.ex +++ b/lib/tesla/mock.ex @@ -135,8 +135,11 @@ defmodule Tesla.Mock do This mock will only be available to the current process. """ - @spec mock((Tesla.Env.t() -> Tesla.Env.t() | {integer, map, any})) :: no_return - def mock(fun) when is_function(fun), do: pdict_set(fun) + @spec mock((Tesla.Env.t() -> Tesla.Env.t() | {integer, map, any})) :: :ok + def mock(fun) when is_function(fun) do + pdict_set(fun) + :ok + end @doc """ Setup global mocks. @@ -144,8 +147,11 @@ defmodule Tesla.Mock do **WARNING**: This mock will be available to ALL processes. It might cause conflicts when running tests in parallel! """ - @spec mock_global((Tesla.Env.t() -> Tesla.Env.t() | {integer, map, any})) :: no_return - def mock_global(fun) when is_function(fun), do: agent_set(fun) + @spec mock_global((Tesla.Env.t() -> Tesla.Env.t() | {integer, map, any})) :: :ok + def mock_global(fun) when is_function(fun) do + agent_set(fun) + :ok + end ## HELPERS @@ -225,10 +231,13 @@ defmodule Tesla.Mock do defp agent_set(fun) do case Process.whereis(__MODULE__) do nil -> - ExUnit.Callbacks.start_supervised!(%{ - id: __MODULE__, - start: {Agent, :start_link, [fn -> fun end, [{:name, __MODULE__}]]} - }) + ExUnit.Callbacks.start_supervised!( + %{ + id: __MODULE__, + start: {Agent, :start_link, [fn -> fun end, [{:name, __MODULE__}]]} + }, + [] + ) pid -> Agent.update(pid, fn _ -> fun end) diff --git a/mix.exs b/mix.exs index ca2987b4..ce64013b 100644 --- a/mix.exs +++ b/mix.exs @@ -16,7 +16,8 @@ defmodule Tesla.Mixfile do lockfile: lockfile(System.get_env("LOCKFILE")), test_coverage: [tool: ExCoveralls], dialyzer: [ - plt_add_apps: [:inets, :idna, :ssl_verify_fun], + plt_core_path: "_build/#{Mix.env()}", + plt_add_apps: [:mix, :inets, :idna, :ssl_verify_fun, :ex_unit], plt_add_deps: :project ], docs: docs()