aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-06-21 11:18:02 -0400
committerJon Moss <me@jonathanmoss.me>2016-06-21 11:18:02 -0400
commit87e8719da3e1623ce8d2c9f4e9ebfcbc7ab3a468 (patch)
tree48d3d8b00e45e313339fecaf3f39769bc8258c95 /activemodel/test
parent7980b31bc6dd123a0635f470998362a602b66e25 (diff)
downloadrails-87e8719da3e1623ce8d2c9f4e9ebfcbc7ab3a468.tar.gz
rails-87e8719da3e1623ce8d2c9f4e9ebfcbc7ab3a468.tar.bz2
rails-87e8719da3e1623ce8d2c9f4e9ebfcbc7ab3a468.zip
Add test to better demonstrate `ActiveModel::Errors#added?` behavior
Fixes #25410.
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/errors_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb
index c90ee7021c..13fa5c76bc 100644
--- a/activemodel/test/cases/errors_test.rb
+++ b/activemodel/test/cases/errors_test.rb
@@ -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")