Skip to content

Instantly share code, notes, and snippets.

@gjaldon
Created April 7, 2017 08:33
Show Gist options
  • Save gjaldon/3bc745ff71bf7a3fe3077b8d2a4403bc to your computer and use it in GitHub Desktop.
Save gjaldon/3bc745ff71bf7a3fe3077b8d2a4403bc to your computer and use it in GitHub Desktop.
# In ConnCase setup
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Reporting.Repo)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Profilix.RepoRead)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Reporting.Repo, {:shared, self()})
Ecto.Adapters.SQL.Sandbox.mode(Reporting.Repo, {:shared, self()})
end
end
# In config/test.exs
config :reporting, Reporting.Repo,
adapter: Ecto.Adapters.MySQL,
username: "gjaldon",
password: "gjaldon",
database: "reporting_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :profilix, Profilix.RepoWrite,
adapter: Ecto.Adapters.MySQL,
username: "gjaldon",
password: "gjaldon",
database: "profilix_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :profilix, Profilix.RepoRead,
adapter: Ecto.Adapters.MySQL,
username: "gjaldon",
password: "gjaldon",
database: "profilix_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment