diff --git a/test/mix/tasks/ecto.dump_load_test.exs b/test/mix/tasks/ecto.dump_load_test.exs index e0699f8f..d2dea30c 100644 --- a/test/mix/tasks/ecto.dump_load_test.exs +++ b/test/mix/tasks/ecto.dump_load_test.exs @@ -10,10 +10,10 @@ defmodule Mix.Tasks.Ecto.DumpLoadTest do @behaviour Ecto.Adapter.Structure defmacro __before_compile__(_), do: :ok - def dumpers(_, _), do: raise "not implemented" - def loaders(_, _), do: raise "not implemented" - def checkout(_, _, _), do: raise "not implemented" - def checked_out?(_), do: raise "not implemented" + def dumpers(_, _), do: raise("not implemented") + def loaders(_, _), do: raise("not implemented") + def checkout(_, _, _), do: raise("not implemented") + def checked_out?(_), do: raise("not implemented") def ensure_all_started(_, _), do: {:ok, []} def init(_opts) do @@ -21,20 +21,20 @@ defmodule Mix.Tasks.Ecto.DumpLoadTest do {:ok, child_spec, %{}} end - def structure_dump(_, _), do: Process.get(:structure_dump) || raise "no structure_dump" - def structure_load(_, _), do: Process.get(:structure_load) || raise "no structure_load" - def dump_cmd(_, _, _), do: Process.get(:dump_cmd) || raise "no dump_cmd" + def structure_dump(_, _), do: Process.get(:structure_dump) || raise("no structure_dump") + def structure_load(_, _), do: Process.get(:structure_load) || raise("no structure_load") + def dump_cmd(_, _, _), do: Process.get(:dump_cmd) || raise("no dump_cmd") end defmodule NoStructureAdapter do @behaviour Ecto.Adapter defmacro __before_compile__(_), do: :ok - def dumpers(_, _), do: raise "not implemented" - def loaders(_, _), do: raise "not implemented" - def init(_), do: raise "not implemented" - def checkout(_, _, _), do: raise "not implemented" - def checked_out?(_), do: raise "not implemented" - def ensure_all_started(_, _), do: raise "not implemented" + def dumpers(_, _), do: raise("not implemented") + def loaders(_, _), do: raise("not implemented") + def init(_), do: raise("not implemented") + def checkout(_, _, _), do: raise("not implemented") + def checked_out?(_), do: raise("not implemented") + def ensure_all_started(_, _), do: raise("not implemented") end # Mocked repos @@ -60,38 +60,47 @@ defmodule Mix.Tasks.Ecto.DumpLoadTest do test "runs the adapter structure_dump" do Process.put(:structure_dump, {:ok, "foo"}) - Dump.run ["-r", to_string(Repo)] + Dump.run(["-r", to_string(Repo)]) assert_received {:mix_shell, :info, [msg]} assert msg =~ "The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been dumped to foo" end test "runs the adapter structure_dump for migration_repo" do - Application.put_env(:ecto_sql, Repo, [migration_repo: MigrationRepo]) + Application.put_env(:ecto_sql, Repo, migration_repo: MigrationRepo) Process.put(:structure_dump, {:ok, "foo"}) - Dump.run ["-r", to_string(Repo)] + Dump.run(["-r", to_string(Repo)]) - assert_received {:mix_shell, :info, ["The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been dumped to foo" <> _]} + assert_received {:mix_shell, :info, + [ + "The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been dumped to foo" <> + _ + ]} - assert_received {:mix_shell, :info, ["The structure for Mix.Tasks.Ecto.DumpLoadTest.MigrationRepo has been dumped to foo" <> _]} + assert_received {:mix_shell, :info, + [ + "The structure for Mix.Tasks.Ecto.DumpLoadTest.MigrationRepo has been dumped to foo" <> + _ + ]} end test "runs the adapter structure_dump with --quiet" do Process.put(:structure_dump, {:ok, "foo"}) - Dump.run ["-r", to_string(Repo), "--quiet"] + Dump.run(["-r", to_string(Repo), "--quiet"]) refute_received {:mix_shell, :info, [_]} end test "raises an error when structure_dump gives an unknown feedback" do Process.put(:structure_dump, {:error, :confused}) + assert_raise Mix.Error, fn -> - Dump.run ["-r", to_string(Repo)] + Dump.run(["-r", to_string(Repo)]) end end test "raises an error on structure_dump when the adapter doesn't define a storage" do assert_raise Mix.Error, ~r/to implement Ecto.Adapter.Structure/, fn -> - Dump.run ["-r", to_string(NoStructureRepo)] + Dump.run(["-r", to_string(NoStructureRepo)]) end end @@ -101,49 +110,58 @@ defmodule Mix.Tasks.Ecto.DumpLoadTest do table_exists? = fn _, _ -> false end Process.put(:structure_load, {:ok, "foo"}) - Load.run ["-r", to_string(Repo)], table_exists? + Load.run(["-r", to_string(Repo)], table_exists?) assert_received {:mix_shell, :info, [msg]} assert msg =~ "The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been loaded from foo" end test "runs the adapter structure_load for migration_repo" do - Application.put_env(:ecto_sql, Repo, [migration_repo: MigrationRepo]) + Application.put_env(:ecto_sql, Repo, migration_repo: MigrationRepo) table_exists? = fn _, _ -> false end Process.put(:structure_load, {:ok, "foo"}) - Load.run ["-r", to_string(Repo)], table_exists? + Load.run(["-r", to_string(Repo)], table_exists?) - assert_received {:mix_shell, :info, ["The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been loaded from foo" <> _]} + assert_received {:mix_shell, :info, + [ + "The structure for Mix.Tasks.Ecto.DumpLoadTest.Repo has been loaded from foo" <> + _ + ]} - assert_received {:mix_shell, :info, ["The structure for Mix.Tasks.Ecto.DumpLoadTest.MigrationRepo has been loaded from foo" <> _]} + assert_received {:mix_shell, :info, + [ + "The structure for Mix.Tasks.Ecto.DumpLoadTest.MigrationRepo has been loaded from foo" <> + _ + ]} end test "runs the adapter structure_load with --quiet" do table_exists? = fn _, _ -> false end Process.put(:structure_load, {:ok, "foo"}) - Load.run ["-r", to_string(Repo), "--quiet"], table_exists? + Load.run(["-r", to_string(Repo), "--quiet"], table_exists?) refute_received {:mix_shell, :info, [_]} end test "skips when the database is loaded with --skip-if-loaded" do table_exists? = fn _, _ -> true end - assert :ok == Load.run ["-r", to_string(Repo), "--skip-if-loaded"], table_exists? + assert :ok == Load.run(["-r", to_string(Repo), "--skip-if-loaded"], table_exists?) end test "raises an error when structure_load gives an unknown feedback" do table_exists? = fn _, _ -> false end Process.put(:structure_load, {:error, :confused}) + assert_raise Mix.Error, fn -> - Load.run ["-r", to_string(Repo)], table_exists? + Load.run(["-r", to_string(Repo)], table_exists?) end end test "raises an error on structure_load when the adapter doesn't define a storage" do assert_raise Mix.Error, ~r/to implement Ecto.Adapter.Structure/, fn -> - Load.run ["-r", to_string(NoStructureRepo)] + Load.run(["-r", to_string(NoStructureRepo)]) end end end diff --git a/test/mix/tasks/ecto.gen.migration_test.exs b/test/mix/tasks/ecto.gen.migration_test.exs index d768fda0..ca16f605 100644 --- a/test/mix/tasks/ecto.gen.migration_test.exs +++ b/test/mix/tasks/ecto.gen.migration_test.exs @@ -23,49 +23,54 @@ defmodule Mix.Tasks.Ecto.Gen.MigrationTest do end test "generates a new migration" do - [path] = run ["-r", to_string(Repo), "my_migration"] + [path] = run(["-r", to_string(Repo), "my_migration"]) assert Path.dirname(path) == @migrations_path assert Path.basename(path) =~ ~r/^\d{14}_my_migration\.exs$/ - assert_file path, fn file -> + + assert_file(path, fn file -> assert file =~ "defmodule Mix.Tasks.Ecto.Gen.MigrationTest.Repo.Migrations.MyMigration do" assert file =~ "use Ecto.Migration" assert file =~ "def change do" - end + end) end test "generates a new migration with Custom Migration Module" do Application.put_env(:ecto_sql, :migration_module, MyCustomApp.MigrationModule) - [path] = run ["-r", to_string(Repo), "my_custom_migration"] + [path] = run(["-r", to_string(Repo), "my_custom_migration"]) Application.delete_env(:ecto_sql, :migration_module) assert Path.dirname(path) == @migrations_path assert Path.basename(path) =~ ~r/^\d{14}_my_custom_migration\.exs$/ - assert_file path, fn file -> - assert file =~ "defmodule Mix.Tasks.Ecto.Gen.MigrationTest.Repo.Migrations.MyCustomMigration do" + + assert_file(path, fn file -> + assert file =~ + "defmodule Mix.Tasks.Ecto.Gen.MigrationTest.Repo.Migrations.MyCustomMigration do" + assert file =~ "use MyCustomApp.MigrationModule" assert file =~ "def change do" - end + end) end test "underscores the filename when generating a migration" do - run ["-r", to_string(Repo), "MyMigration"] + run(["-r", to_string(Repo), "MyMigration"]) assert [name] = File.ls!(@migrations_path) assert name =~ ~r/^\d{14}_my_migration\.exs$/ end test "custom migrations_path" do dir = Path.join([unquote(tmp_path), "custom_migrations"]) - [path] = run ["-r", to_string(Repo), "--migrations-path", dir, "custom_path"] + [path] = run(["-r", to_string(Repo), "--migrations-path", dir, "custom_path"]) assert Path.dirname(path) == dir end test "raises when existing migration exists" do - run ["-r", to_string(Repo), "my_migration"] + run(["-r", to_string(Repo), "my_migration"]) + assert_raise Mix.Error, ~r"migration can't be created", fn -> - run ["-r", to_string(Repo), "my_migration"] + run(["-r", to_string(Repo), "my_migration"]) end end test "raises when missing file" do - assert_raise Mix.Error, fn -> run ["-r", to_string(Repo)] end + assert_raise Mix.Error, fn -> run(["-r", to_string(Repo)]) end end end diff --git a/test/mix/tasks/ecto.migrate_test.exs b/test/mix/tasks/ecto.migrate_test.exs index f331a430..43435b49 100644 --- a/test/mix/tasks/ecto.migrate_test.exs +++ b/test/mix/tasks/ecto.migrate_test.exs @@ -14,12 +14,14 @@ defmodule Mix.Tasks.Ecto.MigrateTest do defmodule Repo do def start_link(_) do Process.put(:started, true) - Task.start_link fn -> + + Task.start_link(fn -> Process.flag(:trap_exit, true) + receive do {:EXIT, _, :normal} -> :ok end - end + end) end def stop do @@ -56,10 +58,12 @@ defmodule Mix.Tasks.Ecto.MigrateTest do test "runs the migrator with app_repo config" do Application.put_env(:ecto_sql, :ecto_repos, [Repo]) - run [], fn _, _, _, _ -> + + run([], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) assert Process.get(:started) after @@ -67,35 +71,38 @@ defmodule Mix.Tasks.Ecto.MigrateTest do end test "runs the migrator after starting repo" do - run ["-r", to_string(Repo)], fn _, _, _, _ -> + run(["-r", to_string(Repo)], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) assert Process.get(:started) end test "runs the migrator with the already started repo" do - run ["-r", to_string(StartedRepo)], fn _, _, _, _ -> + run(["-r", to_string(StartedRepo)], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) assert Process.get(:already_started) end test "runs the migrator with two repos" do - run ["-r", to_string(Repo), "-r", to_string(StartedRepo)], fn _, _, _, _ -> + run(["-r", to_string(Repo), "-r", to_string(StartedRepo)], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) assert Process.get(:started) assert Process.get(:already_started) end test "runs the migrator yielding the repository and migrations path" do - run ["-r", to_string(Repo), "--quiet", "--prefix", "foo"], fn repo, [path], direction, opts -> + run(["-r", to_string(Repo), "--quiet", "--prefix", "foo"], fn repo, [path], direction, opts -> assert repo == Repo refute path =~ ~r/_build/ assert direction == :up @@ -103,26 +110,30 @@ defmodule Mix.Tasks.Ecto.MigrateTest do assert opts[:log] == false assert opts[:prefix] == "foo" [] - end + end) + assert Process.get(:started) end test "runs the migrator with --step" do - run ["-r", to_string(Repo), "-n", "1"], fn repo, [path], direction, opts -> + run(["-r", to_string(Repo), "-n", "1"], fn repo, [path], direction, opts -> assert repo == Repo refute path =~ ~r/_build/ assert direction == :up assert opts == [repo: "Elixir.Mix.Tasks.Ecto.MigrateTest.Repo", step: 1] [] - end + end) + assert Process.get(:started) end test "raises when migrations path does not exist" do File.rm_rf!(@migrations_path) + assert_raise Mix.Error, fn -> - run ["-r", to_string(Repo)], fn _, _, _, _ -> [] end + run(["-r", to_string(Repo)], fn _, _, _, _ -> [] end) end + assert !Process.get(:started) end @@ -132,18 +143,21 @@ defmodule Mix.Tasks.Ecto.MigrateTest do File.mkdir_p!(path1) File.mkdir_p!(path2) - run ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], - fn Repo, [^path1, ^path2], _, _ -> [] end + run( + ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], + fn Repo, [^path1, ^path2], _, _ -> [] end + ) end test "runs the migrator with --to_exclusive" do - run ["-r", to_string(Repo), "--to-exclusive", "12345"], fn repo, [path], direction, opts -> + run(["-r", to_string(Repo), "--to-exclusive", "12345"], fn repo, [path], direction, opts -> assert repo == Repo refute path =~ ~r/_build/ assert direction == :up assert opts == [repo: "Elixir.Mix.Tasks.Ecto.MigrateTest.Repo", to_exclusive: 12345] [] - end + end) + assert Process.get(:started) end end diff --git a/test/mix/tasks/ecto.migrations_test.exs b/test/mix/tasks/ecto.migrations_test.exs index 2dddacd8..11468ece 100644 --- a/test/mix/tasks/ecto.migrations_test.exs +++ b/test/mix/tasks/ecto.migrations_test.exs @@ -14,12 +14,14 @@ defmodule Mix.Tasks.Ecto.MigrationsTest do defmodule Repo do def start_link(_) do Process.put(:started, true) - Task.start_link fn -> + + Task.start_link(fn -> Process.flag(:trap_exit, true) + receive do {:EXIT, _, :normal} -> :ok end - end + end) end def stop() do @@ -40,50 +42,51 @@ defmodule Mix.Tasks.Ecto.MigrationsTest do migrations = fn _, _, _ -> [ - {:up, 0, "up_migration_0"}, - {:up, 20160000000001, "up_migration_1"}, - {:up, 20160000000002, "up_migration_2"}, - {:up, 20160000000003, "up_migration_3"}, - {:down, 20160000000004, "down_migration_1"}, - {:down, 20160000000005, "down_migration_2"} + {:up, 0, "up_migration_0"}, + {:up, 20_160_000_000_001, "up_migration_1"}, + {:up, 20_160_000_000_002, "up_migration_2"}, + {:up, 20_160_000_000_003, "up_migration_3"}, + {:down, 20_160_000_000_004, "down_migration_1"}, + {:down, 20_160_000_000_005, "down_migration_2"} ] end expected_output = """ - Repo: Mix.Tasks.Ecto.MigrationsTest.Repo - - Status Migration ID Migration Name - -------------------------------------------------- - up 0 up_migration_0 - up 20160000000001 up_migration_1 - up 20160000000002 up_migration_2 - up 20160000000003 up_migration_3 - down 20160000000004 down_migration_1 - down 20160000000005 down_migration_2 - """ - run [], migrations, fn i -> assert(i == expected_output) end + Repo: Mix.Tasks.Ecto.MigrationsTest.Repo + + Status Migration ID Migration Name + -------------------------------------------------- + up 0 up_migration_0 + up 20160000000001 up_migration_1 + up 20160000000002 up_migration_2 + up 20160000000003 up_migration_3 + down 20160000000004 down_migration_1 + down 20160000000005 down_migration_2 + """ + + run([], migrations, fn i -> assert(i == expected_output) end) end test "migrations displays the up and down status for any given repo" do migrations = fn _, _, _ -> [ - {:up, 20160000000001, "up_migration_1"}, - {:down, 20160000000002, "down_migration_1"} + {:up, 20_160_000_000_001, "up_migration_1"}, + {:down, 20_160_000_000_002, "down_migration_1"} ] end expected_output = """ - Repo: Mix.Tasks.Ecto.MigrationsTest.Repo + Repo: Mix.Tasks.Ecto.MigrationsTest.Repo - Status Migration ID Migration Name - -------------------------------------------------- - up 20160000000001 up_migration_1 - down 20160000000002 down_migration_1 - """ + Status Migration ID Migration Name + -------------------------------------------------- + up 20160000000001 up_migration_1 + down 20160000000002 down_migration_1 + """ - run ["-r", to_string(Repo)], migrations, fn i -> assert(i == expected_output) end + run(["-r", to_string(Repo)], migrations, fn i -> assert(i == expected_output) end) end test "does not run from _build" do @@ -95,7 +98,7 @@ defmodule Mix.Tasks.Ecto.MigrationsTest do [] end - run [], migrations, fn _ -> :ok end + run([], migrations, fn _ -> :ok end) end test "uses custom paths" do @@ -104,8 +107,10 @@ defmodule Mix.Tasks.Ecto.MigrationsTest do File.mkdir_p!(path1) File.mkdir_p!(path2) - run ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], - fn Repo, [^path1, ^path2], _opts -> [] end, - fn _ -> :ok end + run( + ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], + fn Repo, [^path1, ^path2], _opts -> [] end, + fn _ -> :ok end + ) end end diff --git a/test/mix/tasks/ecto.rollback_test.exs b/test/mix/tasks/ecto.rollback_test.exs index d227ce0b..ce2ebebd 100644 --- a/test/mix/tasks/ecto.rollback_test.exs +++ b/test/mix/tasks/ecto.rollback_test.exs @@ -14,12 +14,14 @@ defmodule Mix.Tasks.Ecto.RollbackTest do defmodule Repo do def start_link(_) do Process.put(:started, true) - Task.start_link fn -> + + Task.start_link(fn -> Process.flag(:trap_exit, true) + receive do {:EXIT, _, :normal} -> :ok end - end + end) end def stop() do @@ -54,39 +56,44 @@ defmodule Mix.Tasks.Ecto.RollbackTest do end test "runs the migrator after starting repo" do - run ["-r", to_string(Repo)], fn _, _, _, _ -> + run(["-r", to_string(Repo)], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) assert Process.get(:started) end test "runs the migrator with already started repo" do - run ["-r", to_string(StartedRepo)], fn _, _, _, _ -> + run(["-r", to_string(StartedRepo)], fn _, _, _, _ -> Process.put(:migrated, true) [] - end + end) + assert Process.get(:migrated) end test "runs the migrator yielding the repository and migrations path" do - run ["-r", to_string(Repo), "--prefix", "foo"], fn repo, [path], direction, opts -> + run(["-r", to_string(Repo), "--prefix", "foo"], fn repo, [path], direction, opts -> assert repo == Repo refute path =~ ~r/_build/ assert direction == :down assert opts[:step] == 1 assert opts[:prefix] == "foo" [] - end + end) + assert Process.get(:started) end test "raises when migrations path does not exist" do File.rm_rf!(@migrations_path) + assert_raise Mix.Error, fn -> - run ["-r", to_string(Repo)], fn _, _, _, _ -> [] end + run(["-r", to_string(Repo)], fn _, _, _, _ -> [] end) end + assert !Process.get(:started) end @@ -96,18 +103,21 @@ defmodule Mix.Tasks.Ecto.RollbackTest do File.mkdir_p!(path1) File.mkdir_p!(path2) - run ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], - fn Repo, [^path1, ^path2], _, _ -> [] end + run( + ["-r", to_string(Repo), "--migrations-path", path1, "--migrations-path", path2], + fn Repo, [^path1, ^path2], _, _ -> [] end + ) end test "runs the migrator with --to_exclusive" do - run ["-r", to_string(Repo), "--to-exclusive", "12345"], fn repo, [path], direction, opts -> + run(["-r", to_string(Repo), "--to-exclusive", "12345"], fn repo, [path], direction, opts -> assert repo == Repo refute path =~ ~r/_build/ assert direction == :down assert opts == [repo: "Elixir.Mix.Tasks.Ecto.RollbackTest.Repo", to_exclusive: 12345] [] - end + end) + assert Process.get(:started) end end diff --git a/test/test_helper.exs b/test/test_helper.exs index dec77a95..1dc161b7 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -4,8 +4,8 @@ Mix.shell(Mix.Shell.Process) System.put_env("ECTO_EDITOR", "") Logger.configure(level: :info) -Code.require_file "test_repo.exs", __DIR__ -Code.require_file "../integration_test/support/file_helpers.exs", __DIR__ +Code.require_file("test_repo.exs", __DIR__) +Code.require_file("../integration_test/support/file_helpers.exs", __DIR__) ExUnit.start() if function_exported?(ExUnit, :after_suite, 1) do diff --git a/test/test_repo.exs b/test/test_repo.exs index bd56015b..5d0ec321 100644 --- a/test/test_repo.exs +++ b/test/test_repo.exs @@ -29,17 +29,17 @@ defmodule EctoSQL.TestAdapter do def ensure_all_started(_, _), do: {:ok, []} def init(_opts) do - child_spec = Supervisor.child_spec {Task, fn -> :timer.sleep(:infinity) end}, [] + child_spec = Supervisor.child_spec({Task, fn -> :timer.sleep(:infinity) end}, []) {:ok, child_spec, %{meta: :meta}} end - def checkout(_, _, _), do: raise "not implemented" - def checked_out?(_), do: raise "not implemented" - def delete(_, _, _, _), do: raise "not implemented" - def insert_all(_, _, _, _, _, _, _, _), do: raise "not implemented" - def rollback(_, _), do: raise "not implemented" - def stream(_, _, _, _, _), do: raise "not implemented" - def update(_, _, _, _, _, _), do: raise "not implemented" + def checkout(_, _, _), do: raise("not implemented") + def checked_out?(_), do: raise("not implemented") + def delete(_, _, _, _), do: raise("not implemented") + def insert_all(_, _, _, _, _, _, _, _), do: raise("not implemented") + def rollback(_, _), do: raise("not implemented") + def stream(_, _, _, _, _), do: raise("not implemented") + def update(_, _, _, _, _, _), do: raise("not implemented") ## Types @@ -53,13 +53,16 @@ defmodule EctoSQL.TestAdapter do # Migration emulation - def execute(_, _, {:nocache, {:all, %{from: %{source: {"schema_migrations", _}}}}}, _, opts) do + def execute(_, _, {:nocache, {:all, query}}, _, opts) do + %{from: %{source: {"schema_migrations", _}}} = query true = opts[:schema_migration] versions = MigrationsAgent.get() {length(versions), Enum.map(versions, &[elem(&1, 0)])} end - def execute(_, _meta, {:nocache, {:delete_all, %{from: %{source: {"schema_migrations", _}}}}}, [version], opts) do + def execute(_, _, {:nocache, {:delete_all, query}}, params, opts) do + %{from: %{source: {"schema_migrations", _}}} = query + [version] = params true = opts[:schema_migration] MigrationsAgent.down(version, opts) {1, nil} @@ -76,7 +79,7 @@ defmodule EctoSQL.TestAdapter do def transaction(mod, _opts, fun) do Process.put(:in_transaction?, true) - send test_process(), {:transaction, mod, fun} + send(test_process(), {:transaction, mod, fun}) {:ok, fun.()} after Process.put(:in_transaction?, false) @@ -85,7 +88,7 @@ defmodule EctoSQL.TestAdapter do ## Migrations def lock_for_migrations(mod, opts, fun) do - send test_process(), {:lock_for_migrations, mod, fun, opts} + send(test_process(), {:lock_for_migrations, mod, fun, opts}) fun.() end