diff options
author | Angelo capilleri <capilleri@yahoo.com> | 2013-02-19 18:24:31 +0100 |
---|---|---|
committer | Angelo capilleri <capilleri@yahoo.com> | 2013-02-19 18:48:37 +0100 |
commit | 40c1ee8b7d4b316638870210e4c75bf9e76e5ed3 (patch) | |
tree | f6f7488126cac4695001c34777703ac120a95e6d /activemodel/test/cases | |
parent | ff259b524944ff974c415c4d8808652721939546 (diff) | |
download | rails-40c1ee8b7d4b316638870210e4c75bf9e76e5ed3.tar.gz rails-40c1ee8b7d4b316638870210e4c75bf9e76e5ed3.tar.bz2 rails-40c1ee8b7d4b316638870210e4c75bf9e76e5ed3.zip |
added more accurate test for add_on_empty
with the current tests, if delete the assignment of is_empty in add_on_empty method
the tests not fail. With this test, if we delete is_empty, the test fails
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index cc0c3f16d2..51dcfc37d8 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -274,6 +274,13 @@ class ErrorsTest < ActiveModel::TestCase 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, {}) |