1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test to better demonstrate ActiveModel::Errors#added? behavior

Fixes #25410.
This commit is contained in:
Jon Moss 2016-06-21 11:18:02 -04:00
parent 7980b31bc6
commit 87e8719da3
No known key found for this signature in database
GPG key ID: 7CE26AA47EFC5B12

View file

@ -219,6 +219,12 @@ class ErrorsTest < ActiveModel::TestCase
assert !person.errors.added?(:name, "cannot be blank")
end
test "added? returns false when checking for an error, but not providing message arguments" do
person = Person.new
person.errors.add(:name, "cannot be blank")
assert !person.errors.added?(:name)
end
test "size calculates the number of error messages" do
person = Person.new
person.errors.add(:name, "cannot be blank")