Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/tesla/mock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ defmodule Tesla.Mock do
# we will check mocks *both* in $callers and $ancestors
# We might want to remove checking in $ancestors in a major release
ancestors = Process.get(:"$ancestors", [])
potential_mock_holder_pids = [self() | Enum.reverse(callers) ++ Enum.reverse(ancestors)]

potential_mock_holder_pids =
[self() | Enum.reverse(callers) ++ Enum.reverse(ancestors)]
|> Enum.map(fn
pid when is_pid(pid) -> pid
atom when is_atom(atom) -> Process.whereis(atom)
end)
|> Enum.filter(&is_pid/1)

Enum.find_value(potential_mock_holder_pids, nil, fn pid ->
{:dictionary, process_dictionary} = Process.info(pid, :dictionary)
Expand Down
Loading