Hi all
I wrote a test as follow:
test "a invalid country code" do
changeset = Country.changeset(%Country{}, @invalid_attrs)
assert [{:code, "should be at most 2 character(s)"}, {:en, "can't be blank"}] in errors_on(%Country{}, @invalid_attrs)
end
When I run the test, then it failed:
1) test a invalid country code (Pubcus.CountryModelTest)
test/models/country_model_test.exs:17
Assertion with in failed
code: [code: "should be at most 2 character(s)", en: "can't be blank"] in errors_on(%Country{}, @invalid_attrs)
lhs: [code: "should be at most 2 character(s)", en: "can't be blank"]
rhs: [code: "should be at most 2 character(s)", en: "can't be blank"]
stacktrace:
test/models/country_model_test.exs:20: (test)
What am I doing wrong? The return message seems to be the same as I defined.
Thanks