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

Merge pull request #25415 from maclover7/jm-fix-25410

Add test to better demonstrate `ActiveModel::Errors#added?` behavior
This commit is contained in:
Rafael França 2016-06-21 16:47:44 -03:00 committed by GitHub
commit 1a4474c2c7

View file

@ -219,6 +219,12 @@ class ErrorsTest < ActiveModel::TestCase
assert !person.errors.added?(:name, "cannot be blank") assert !person.errors.added?(:name, "cannot be blank")
end 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 test "size calculates the number of error messages" do
person = Person.new person = Person.new
person.errors.add(:name, "cannot be blank") person.errors.add(:name, "cannot be blank")