test: adapt tests for attribute-level default solution

This commit is contained in:
Moritz 2026-01-25 13:39:18 +01:00 committed by Simon
parent f984819508
commit 93e966bc6b
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
4 changed files with 37 additions and 20 deletions

View file

@ -31,7 +31,9 @@ defmodule Mv.DataCase do
setup tags do
Mv.DataCase.setup_sandbox(tags)
# Ensure "Mitglied" role exists for AssignDefaultRole to work in tests
# 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()
:ok
end
@ -49,7 +51,7 @@ defmodule Mv.DataCase do
@doc """
Ensures the default "Mitglied" role exists in the test database.
This is necessary because AssignDefaultRole expects this role to exist.
This is necessary because the role_id attribute's default function expects this role to exist.
Tests run in sandbox mode, so the role needs to be created for each test.
"""
def ensure_default_role do