diff options
author | Akira Matsuda <ronnie@dio.jp> | 2009-03-19 14:40:42 +0900 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-11 18:34:12 -0700 |
commit | 68b2b730e46de8415ece93701ea40434ae080353 (patch) | |
tree | 78d75c88d3464d4691d2b93d3b86a059afd9e2c7 /activerecord/test | |
parent | b22c951e7adabe8d37ee2804487c267d5e2006b1 (diff) | |
download | rails-68b2b730e46de8415ece93701ea40434ae080353.tar.gz rails-68b2b730e46de8415ece93701ea40434ae080353.tar.bz2 rails-68b2b730e46de8415ece93701ea40434ae080353.zip |
Fix default_error_messages back to the original message
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test')
-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 |