Files
chess-endgame-trainer/test/support/fixtures/themes_fixtures.ex
T
owenrees cd2e7f0164 Rename Tag to Theme across code and schema
Rename the endgame-label concept from Tag to Theme to match the glossary:
the context becomes Chesstrainer.Themes, the schema Chesstrainer.Themes.Theme,
and the Endgame association is :themes. The category enum
(endgame/opening/tactic) is preserved.

Rewrite the original migrations in place so themes / endgames_themes
(with theme_id) are created directly, instead of adding a transition
migration.

Closes #12
2026-11-02 09:14:17 +01:00

27 lines
554 B
Elixir

defmodule Chesstrainer.ThemesFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Chesstrainer.Themes` context.
"""
@doc """
Generate a unique theme name.
"""
def unique_theme_name, do: "some name#{System.unique_integer([:positive])}"
@doc """
Generate a theme.
"""
def theme_fixture(attrs \\ %{}) do
{:ok, theme} =
attrs
|> Enum.into(%{
category: :endgame,
name: unique_theme_name()
})
|> Chesstrainer.Themes.create_theme()
theme
end
end