Fix `languages` tests.

main
Joshua Potter 2023-12-05 16:09:19 -07:00
parent e43009f166
commit 54c7d14669
3 changed files with 6 additions and 4 deletions

View File

@ -5,13 +5,14 @@ defmodule BoardWise.Languages.Language do
schema "languages" do
field :code, :string
field :name, :string
field :pos, :integer
end
@doc false
def changeset(language, attrs) do
language
|> cast(attrs, [:code, :name])
|> validate_required([:code, :name])
|> cast(attrs, [:code, :name, :pos])
|> validate_required([:code, :name, :pos])
|> unique_constraint(:code_unique, name: :code_unique)
end
end

View File

@ -21,7 +21,7 @@ defmodule BoardWise.LanguagesTest do
end
test "create_language/1 with valid data creates a language" do
valid_attrs = %{code: "some code", name: "some name"}
valid_attrs = %{code: "some code", name: "some name", pos: 1000}
assert {:ok, %Language{} = language} = Languages.create_language(valid_attrs)
assert language.code == "some code"

View File

@ -12,7 +12,8 @@ defmodule BoardWise.LanguagesFixtures do
attrs
|> Enum.into(%{
code: "some code",
name: "some name"
name: "some name",
pos: 0
})
|> BoardWise.Languages.create_language()