ash_postgres/test/support/repo_case.ex

29 lines
473 B
Elixir
Raw Normal View History

2020-09-03 20:18:11 +12:00
defmodule AshPostgres.RepoCase do
@moduledoc false
use ExUnit.CaseTemplate
alias Ecto.Adapters.SQL.Sandbox
using do
quote do
alias AshPostgres.TestRepo
import Ecto
import Ecto.Query
import AshPostgres.RepoCase
# and any other stuff
end
end
setup tags do
:ok = Sandbox.checkout(AshPostgres.TestRepo)
unless tags[:async] do
Sandbox.mode(AshPostgres.TestRepo, {:shared, self()})
end
:ok
end
end