Fix `languages` tests.
parent
e43009f166
commit
54c7d14669
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue