Current section
Files
Jump to
Current section
Files
lib/mix/tasks/bex_test_template.eex
defmodule <%= inspect(@test_module) %> do
use ExUnit.Case, async: true
import Mox
<%= for {mox_fun, mox_arity, {mod, fun, args}} <- @funs do %>
test "<%= inspect(mod) %>.<%= fun %>/<%= Enum.count(args) %>" do
test_process = self()
<%= inspect(@mox_module) %>
|> expect(:<%= mox_fun %>, 1, fn <%= Enum.map_join(1..mox_arity, ", ", & "_arg_#{&1}") %> ->
send(test_process, {:<%= fun %>, <%= mox_arity %>})
end)
<%= inspect(mod) %>.<%= fun %>(<%= Enum.map_join(args, ", ", fn _ -> "nil" end) %>)
assert_receive({:<%= fun %>, <%= mox_arity %>})
end
<% end %>
end