mirror of https://github.com/rails/rails
added more accurate test for add_on_empty
with the current tests, if delete the assignment of is_empty in add_on_empty method the tests not fail. With this test, if we delete is_empty, the test fails
This commit is contained in:
parent
ff259b5249
commit
40c1ee8b7d
|
@ -274,6 +274,13 @@ class ErrorsTest < ActiveModel::TestCase
|
|||
person.errors.add_on_empty :name, :message => 'custom'
|
||||
end
|
||||
|
||||
test "add_on_empty generates message with empty string value" do
|
||||
person = Person.new
|
||||
person.name = ''
|
||||
person.errors.expects(:generate_message).with(:name, :empty, {})
|
||||
person.errors.add_on_empty :name
|
||||
end
|
||||
|
||||
test "add_on_blank generates message" do
|
||||
person = Person.new
|
||||
person.errors.expects(:generate_message).with(:name, :blank, {})
|
||||
|
|
Loading…
Reference in New Issue