{:username, {""should be at most %{count} ...", ...}
is how the errors are represented in the your_changeset.errors
keyword list.
errors_on/2
, which is a Phoenix test helper, transforms the errors into another keyword list by using Ecto.Changeset.traverse_errors/2
- what you get back is e.g.: [username: "should be at most 20 character(s)"]
.
Thus, in your test you need to either do:
assert {:username, {"should be at most %{count} ...", ...}} in changeset.errors
assert {:username, "should be at most 20 character(s)"} in errors_on(...)