I’m writing a test to make sure the correct version of function is called. I’ve got:
defmodule Foo do
def query do
end
end
and
defmodule Bar do
def query do
end
end
and finally
defmodule Test do
def run do
case something do
true -> Bar.query()
_ -> Foo.query()
end
end
end
In my test I’m doing:
test "something" do
Test.run()
assert_receive :run
end
This fails with
“No message matching :run after 100ms.
The process mailbox is empty.”
Is there a way using ExUnit assert_receive(d) to decide which one was called when I call Test.run() ? I might be just thinking about this the entirely wrong way, I guess.