File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ defmodule Ecto.Adapters.SQL.Sandbox do
45
45
46
46
setup do
47
47
# Explicitly get a connection before each test
48
- :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
48
+ pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Repo)
49
+ on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
50
+ :ok
49
51
end
50
52
51
53
test "create post" do
@@ -102,6 +104,9 @@ defmodule Ecto.Adapters.SQL.Sandbox do
102
104
the parent's connection (i.e. the test process' connection) to
103
105
the task.
104
106
107
+ Besides calling `allow/3` allowance can also be provided to processes
108
+ via [Caller Tracking](`m:Task#module-ancestor-and-caller-tracking`).
109
+
105
110
Because allowances use an explicit mechanism, their advantage
106
111
is that you can still run your tests in async mode. The downside
107
112
is that you need to explicitly control and allow every single
@@ -148,7 +153,7 @@ defmodule Ecto.Adapters.SQL.Sandbox do
148
153
149
154
There are two mechanisms for explicit ownerships:
150
155
151
- * Using allowances - requires explicit allowances via `allow/3` .
156
+ * Using allowances - requires explicit allowances.
152
157
Tests may run concurrently.
153
158
154
159
* Using shared mode - does not require explicit allowances.
You can’t perform that action at this time.
0 commit comments