Skip to content
This repository
Browse code

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 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 activemodel/test/cases/errors_test.rb
7 activemodel/test/cases/errors_test.rb
@@ -274,6 +274,13 @@ def test_has_key?
274 274 person.errors.add_on_empty :name, :message => 'custom'
275 275 end
276 276
  277 + test "add_on_empty generates message with empty string value" do
  278 + person = Person.new
  279 + person.name = ''
  280 + person.errors.expects(:generate_message).with(:name, :empty, {})
  281 + person.errors.add_on_empty :name
  282 + end
  283 +
277 284 test "add_on_blank generates message" do
278 285 person = Person.new
279 286 person.errors.expects(:generate_message).with(:name, :blank, {})

0 comments on commit 45547a1

Please sign in to comment.
Something went wrong with that request. Please try again.