Permalink
Browse files

Merge pull request #9324 from acapilleri/add_on_empty

added more accurate test for add_on_empty
  • Loading branch information...
2 parents 2769180 + 40c1ee8 commit 45547a1e9321211a611ffa1e06a31c022155b157 @steveklabnik steveklabnik committed Feb 19, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 activemodel/test/cases/errors_test.rb
View
7 activemodel/test/cases/errors_test.rb
@@ -274,6 +274,13 @@ def test_has_key?
person.errors.add_on_empty :name, :message => 'custom'
end
+ test "add_on_empty generates message with empty string value" do
+ person = Person.new
+ person.name = ''
+ person.errors.expects(:generate_message).with(:name, :empty, {})
+ person.errors.add_on_empty :name
+ end
+
test "add_on_blank generates message" do
person = Person.new
person.errors.expects(:generate_message).with(:name, :blank, {})

0 comments on commit 45547a1

Please sign in to comment.