From d69c98540aeaea572b591c26225967a7bf6b3c24 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Sat, 20 Feb 2021 21:36:04 +0300 Subject: [PATCH] use pid instead of process name in `allow` example It seems like `allow/3` [expects](https://github.com/elixir-ecto/db_connection/blob/a588895d35ae8913ab1d86d734df9129f0c59855/lib/db_connection/ownership/manager.ex#L38) a pid to be given. --- lib/ecto/adapters/sql/sandbox.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ecto/adapters/sql/sandbox.ex b/lib/ecto/adapters/sql/sandbox.ex index 331c110f9..4a7b4efe4 100644 --- a/lib/ecto/adapters/sql/sandbox.ex +++ b/lib/ecto/adapters/sql/sandbox.ex @@ -93,7 +93,8 @@ defmodule Ecto.Adapters.SQL.Sandbox do to collaborate over the same connection. Let's give it a try: test "calls worker that runs a query" do - Ecto.Adapters.SQL.Sandbox.allow(Repo, self(), MyApp.Worker) + allow = Process.whereis(MyApp.Worker) + Ecto.Adapters.SQL.Sandbox.allow(Repo, self(), allow) GenServer.call(MyApp.Worker, :run_query) end