Dear all,
I’ve been reading the Programming Phoenix book and have been enjoying it tremendously so far. However, I’ve encountered a a problem with the ExUnit test in user_test.exs which I can’t solve on my own yet.
My problem is similar to this thread. But in my case, the next testcase is faulty.
test "registration_changeset password must be at least 6 chars long" do
attrs = Map.put(@valid_attrs, :password, "12345")
changeset = User.registration_changeset(%User{}, attrs)
assert {:password, "should be at least %{count} character(s)", count: 6} in changeset.errors
end
When I run the test, I get the following error:
1) test registration_changeset password must be at least 6 chars long (Rumbl.UserTest)
test/models/user_test.exs:19
Assertion with in failed
code: {:password, "should be at least %{count} character(s)", [count: 6]} in changeset.errors()
left: {:password, "should be at least %{count} character(s)", [count: 6]}
right: [password: {"should be at least %{count} character(s)",
[count: 6, validation: :length, min: 6]}]
stacktrace:
test/models/user_test.exs:23: (test)
How can I fix my test case? I tried different techniques, but nothing worked Any hints would be greatly appreciated!
Elixir version: 1.4.1
Phoenix version: 1.2.1