diff options
author | Alessandro Rodi <alessandro.rodi@renuo.ch> | 2017-11-10 09:38:05 +0100 |
---|---|---|
committer | Alessandro Rodi <alessandro.rodi@renuo.ch> | 2017-11-13 17:27:47 +0100 |
commit | 15cb4efadb61a8813967d3c25f4adfc9a918a0c0 (patch) | |
tree | 7e5a14f9f6675c3ca159772271d784a00be4ea9d /activemodel/test | |
parent | 8c7967c9b916fe625e7ce10591b101abde3be4f5 (diff) | |
download | rails-15cb4efadb61a8813967d3c25f4adfc9a918a0c0.tar.gz rails-15cb4efadb61a8813967d3c25f4adfc9a918a0c0.tar.bz2 rails-15cb4efadb61a8813967d3c25f4adfc9a918a0c0.zip |
fix bug on added? method
fix rubocop issues
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") |