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:
commit
1a4474c2c7
1 changed files with 6 additions and 0 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue