Refactor require_migration/1 into a test helper function
This commit is contained in:
parent
67389b77af
commit
b87a1f8eaf
|
@ -1,14 +1,10 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
|
defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
|
||||||
use Pleroma.DataCase
|
use Pleroma.DataCase
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
import Pleroma.Tests.Helpers, only: [require_migration: 1]
|
||||||
alias Pleroma.ConfigDB
|
alias Pleroma.ConfigDB
|
||||||
|
|
||||||
setup_all do
|
setup_all do: require_migration("20200716195806_autolinker_to_linkify")
|
||||||
[{module, _}] =
|
|
||||||
Code.require_file("20200716195806_autolinker_to_linkify.exs", "priv/repo/migrations")
|
|
||||||
|
|
||||||
{:ok, %{migration: module}}
|
|
||||||
end
|
|
||||||
|
|
||||||
test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: migration} do
|
test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: migration} do
|
||||||
autolinker_opts = [
|
autolinker_opts = [
|
||||||
|
|
|
@ -32,6 +32,11 @@ defmacro clear_config(config_path, temp_setting) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def require_migration(migration_name) do
|
||||||
|
[{module, _}] = Code.require_file("#{migration_name}.exs", "priv/repo/migrations")
|
||||||
|
{:ok, %{migration: module}}
|
||||||
|
end
|
||||||
|
|
||||||
defmacro __using__(_opts) do
|
defmacro __using__(_opts) do
|
||||||
quote do
|
quote do
|
||||||
import Pleroma.Tests.Helpers,
|
import Pleroma.Tests.Helpers,
|
||||||
|
|
Loading…
Reference in a new issue