Current section

Files

Jump to
raxx_kit priv template test support repo_case.ex.eex
Raw

priv/template/test/support/repo_case.ex.eex

<%= if @ecto do %>defmodule <%= @module %>.RepoCase do
use ExUnit.CaseTemplate
# SEE https://hexdocs.pm/ecto/testing-with-ecto.html for more information
using do
quote do
# alias <%= @module %>.Repo
# import Ecto
# import Ecto.Query
# import <%= @module %>.RepoCase
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(<%= @module %>.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(<%= @module %>.Repo, {:shared, self()})
end
:ok
end
end
<% end %>