diff options
Diffstat (limited to 'activerecord/test/cases/validations_test.rb')
-rw-r--r-- | activerecord/test/cases/validations_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index 6fd7fe6a21..5cdb623eef 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -149,15 +149,18 @@ class ValidationsTest < ActiveRecord::TestCase end def test_validates_length_with_globally_modified_error_message - ActiveSupport::Deprecation.silence do - ActiveRecord::Errors.default_error_messages[:too_short] = 'tu est trops petit hombre {{count}}' - end + defaults = ActiveSupport::Deprecation.silence { ActiveRecord::Errors.default_error_messages } + original_message = defaults[:too_short] + defaults[:too_short] = 'tu est trops petit hombre {{count}}' Topic.validates_length_of :title, :minimum => 10 t = Topic.create(:title => 'too short') assert !t.valid? assert_equal ['tu est trops petit hombre 10'], t.errors[:title] + + ensure + defaults[:too_short] = original_message end def test_validates_acceptance_of_as_database_column |