Permalink
Browse files

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
  • Loading branch information...
bobbus committed Jan 22, 2014
1 parent 75cd7bc commit 1c2c5527032f7a79aff53d29e9640e27957f1b49
Showing with 5 additions and 0 deletions.
  1. +5 −0 activemodel/test/cases/errors_test.rb
@@ -54,6 +54,11 @@ def test_has_key?
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!

0 comments on commit 1c2c552

Please sign in to comment.