diff options
Diffstat (limited to 'activemodel/test/cases/validations_test.rb')
-rw-r--r-- | activemodel/test/cases/validations_test.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb index 78565177d8..38a2a716a7 100644 --- a/activemodel/test/cases/validations_test.rb +++ b/activemodel/test/cases/validations_test.rb @@ -9,11 +9,12 @@ require 'models/custom_reader' class ValidationsTest < ActiveModel::TestCase include ActiveModel::TestsDatabase - include ActiveModel::ValidationsRepairHelper # Most of the tests mess with the validations of Topic, so lets repair it all the time. # Other classes we mess with will be dealt with in the specific tests - repair_validations(Topic) + def teardown + Topic.reset_callbacks(:validate) + end def test_single_field_validation r = Reply.new @@ -70,6 +71,12 @@ class ValidationsTest < ActiveModel::TestCase assert_equal 2, r.errors.count end + def test_errors_on_nested_attributes_expands_name + t = Topic.new + t.errors["replies.name"] << "can't be blank" + assert_equal ["Replies name can't be blank"], t.errors.full_messages + end + def test_errors_on_base r = Reply.new r.content = "Mismatch" |