Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9324 from acapilleri/add_on_empty

added more accurate test for add_on_empty
  • Loading branch information...
commit 45547a1e9321211a611ffa1e06a31c022155b157 2 parents 2769180 + 40c1ee8
Steve Klabnik steveklabnik authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 activemodel/test/cases/errors_test.rb
7 activemodel/test/cases/errors_test.rb
View
@@ -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, {})
Please sign in to comment.
Something went wrong with that request. Please try again.