mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
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
27 lines
554 B
Elixir
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
|