aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorJeremy Baker <jhubert@gmail.com>2018-07-14 00:57:43 -0500
committerJeremy Baker <jhubert@gmail.com>2018-07-14 13:19:46 -0500
commita19918124d7d7dcaf546294d9357335c43fbc0ac (patch)
tree0f6abf0dacb1decd2e2d917bac8dbd8d449bc481 /activemodel/test
parentbd5eba1adff8fa72429f5889ae26097e9756ceb0 (diff)
downloadrails-a19918124d7d7dcaf546294d9357335c43fbc0ac.tar.gz
rails-a19918124d7d7dcaf546294d9357335c43fbc0ac.tar.bz2
rails-a19918124d7d7dcaf546294d9357335c43fbc0ac.zip
Ensure attribute is a symbol in the added? method
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 6ff3be1308..41ff6443fe 100644
--- a/activemodel/test/cases/errors_test.rb
+++ b/activemodel/test/cases/errors_test.rb
@@ -185,6 +185,12 @@ class ErrorsTest < ActiveModel::TestCase
assert person.errors.added?(:name, :blank)
end
+ test "added? returns true when string attribute is used with a symbol message" do
+ person = Person.new
+ person.errors.add(:name, :blank)
+ assert person.errors.added?("name", :blank)
+ end
+
test "added? handles proc messages" do
person = Person.new
message = Proc.new { "cannot be blank" }