diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-11-13 16:13:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 16:13:54 -0500 |
commit | 233d6a2b563e34156c5fc2317c19dc1823447c18 (patch) | |
tree | a1e0e86b98b7cdcf5ecb748a2fcf38ffa29afc50 /activemodel/test | |
parent | 68fe6b08ee72cc47263e0d2c9ff07f75c4b42761 (diff) | |
parent | 15cb4efadb61a8813967d3c25f4adfc9a918a0c0 (diff) | |
download | rails-233d6a2b563e34156c5fc2317c19dc1823447c18.tar.gz rails-233d6a2b563e34156c5fc2317c19dc1823447c18.tar.bz2 rails-233d6a2b563e34156c5fc2317c19dc1823447c18.zip |
Merge pull request #31117 from renuo/fix_errors_added
fix bug on added? method
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index ab18af0de1..d5c282b620 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -223,6 +223,13 @@ class ErrorsTest < ActiveModel::TestCase assert !person.errors.added?(:name) end + test "added? returns false when checking for an error by symbol and a different error with same message is present" do + I18n.backend.store_translations("en", errors: { attributes: { name: { wrong: "is wrong", used: "is wrong" } } }) + person = Person.new + person.errors.add(:name, :wrong) + assert !person.errors.added?(:name, :used) + end + test "size calculates the number of error messages" do person = Person.new person.errors.add(:name, "cannot be blank") |