Skip to content

Commit 2ee0684

Browse files
authored
Unallow existing allowances when attempting to allow a Plug to access a connection (#193)
1 parent 93143d5 commit 2ee0684

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/phoenix_ecto/sql/sandbox.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ defmodule Phoenix.Ecto.SQL.Sandbox do
339339
end
340340

341341
def allow(%{repo: repo, owner: owner}, sandbox),
342-
do: Enum.each(List.wrap(repo), &sandbox.allow(&1, owner, self()))
342+
do: Enum.each(List.wrap(repo), &sandbox.allow(&1, owner, self(), unallow_existing: true))
343343

344344
def allow(%{}, _sandbox), do: :ok
345345
def allow(nil, _sandbox), do: :ok

test/phoenix_ecto/sql/sandbox_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule PhoenixEcto.SQL.SandboxTest do
1515
:ok
1616
end
1717

18-
def allow(repo, owner, _allowed) do
18+
def allow(repo, owner, _allowed, _opts \\ []) do
1919
send(owner, {:allowed, repo})
2020
end
2121
end

0 commit comments

Comments
 (0)