diff options
author | Adrien Coquio <adrien.coquio@gmail.com> | 2014-01-22 15:22:35 +0100 |
---|---|---|
committer | Adrien Coquio <adrien.coquio@gmail.com> | 2014-01-22 15:49:08 +0100 |
commit | 1c2c5527032f7a79aff53d29e9640e27957f1b49 (patch) | |
tree | 05b57ba1a5cc978a080793ba7bb6fc4c33a63fc6 /activemodel | |
parent | 75cd7bc3c2fe1dca24dd1b03d61e9ff173b3d65f (diff) | |
download | rails-1c2c5527032f7a79aff53d29e9640e27957f1b49.tar.gz rails-1c2c5527032f7a79aff53d29e9640e27957f1b49.tar.bz2 rails-1c2c5527032f7a79aff53d29e9640e27957f1b49.zip |
Add failing test for ActiveModel::Errors#has_key? method
From the doc, this method should return false and not nil if there is no errors for this key
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index bbd186d83d..481f274936 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -54,6 +54,11 @@ class ErrorsTest < ActiveModel::TestCase assert errors.has_key?(:foo), 'errors should have key :foo' end + def test_has_no_key + errors = ActiveModel::Errors.new(self) + assert_equal false, errors.has_key?(:name), 'errors should not have key :name' + end + test "clear errors" do person = Person.new person.validate! |