summaryrefslogtreecommitdiff
path: root/test/support/repo_case.ex
blob: 73abcff5057e2c26f94ee321bbf6d947cb3e4742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
defmodule Chessh.RepoCase do
  use ExUnit.CaseTemplate

  using do
    quote do
      alias Chessh.Repo

      import Ecto
      import Ecto.Query
      import Chessh.RepoCase

      # and any other stuff
    end
  end

  setup tags do
    :ok = Ecto.Adapters.SQL.Sandbox.checkout(Chessh.Repo)

    unless tags[:async] do
      Ecto.Adapters.SQL.Sandbox.mode(Chessh.Repo, {:shared, self()})
    end

    :ok
  end
end