diff --git a/lib/phoenix_ecto/sql/sandbox.ex b/lib/phoenix_ecto/sql/sandbox.ex index 2c1bc34..928bda3 100644 --- a/lib/phoenix_ecto/sql/sandbox.ex +++ b/lib/phoenix_ecto/sql/sandbox.ex @@ -339,7 +339,7 @@ defmodule Phoenix.Ecto.SQL.Sandbox do end def allow(%{repo: repo, owner: owner}, sandbox), - do: Enum.each(List.wrap(repo), &sandbox.allow(&1, owner, self())) + do: Enum.each(List.wrap(repo), &sandbox.allow(&1, owner, self(), unallow_existing: true)) def allow(%{}, _sandbox), do: :ok def allow(nil, _sandbox), do: :ok diff --git a/test/phoenix_ecto/sql/sandbox_test.exs b/test/phoenix_ecto/sql/sandbox_test.exs index 3e23474..192b0a4 100644 --- a/test/phoenix_ecto/sql/sandbox_test.exs +++ b/test/phoenix_ecto/sql/sandbox_test.exs @@ -15,7 +15,7 @@ defmodule PhoenixEcto.SQL.SandboxTest do :ok end - def allow(repo, owner, _allowed) do + def allow(repo, owner, _allowed, _opts \\ []) do send(owner, {:allowed, repo}) end end