Fix Credo Design in test support and member index test
Add aliases in fixtures, conn_case, data_case. Use aliases in index_test.exs. Remove empty placeholder test files.
This commit is contained in:
parent
7a8b069834
commit
e537f4eb31
6 changed files with 132 additions and 118 deletions
|
|
@ -16,6 +16,9 @@ defmodule Mv.DataCase do
|
|||
|
||||
use ExUnit.CaseTemplate
|
||||
|
||||
alias Ecto.Adapters.SQL.Sandbox, as: Sandbox
|
||||
alias Mv.Repo
|
||||
|
||||
require Ash.Query
|
||||
|
||||
using do
|
||||
|
|
@ -30,11 +33,11 @@ defmodule Mv.DataCase do
|
|||
end
|
||||
|
||||
setup tags do
|
||||
Mv.DataCase.setup_sandbox(tags)
|
||||
setup_sandbox(tags)
|
||||
# Ensure "Mitglied" role exists for default role assignment to work in tests
|
||||
# Note: This runs in every test because each test runs in a sandboxed database.
|
||||
# The check is fast (single query) and idempotent (skips if role exists).
|
||||
Mv.DataCase.ensure_default_role()
|
||||
ensure_default_role()
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
@ -43,8 +46,8 @@ defmodule Mv.DataCase do
|
|||
Returns the owner pid for use with Phoenix.Ecto.SQL.Sandbox.
|
||||
"""
|
||||
def setup_sandbox(tags) do
|
||||
pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Mv.Repo, shared: not tags[:async])
|
||||
on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
|
||||
pid = Sandbox.start_owner!(Repo, shared: not tags[:async])
|
||||
on_exit(fn -> Sandbox.stop_owner(pid) end)
|
||||
pid
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue