aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/validations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/validations_test.rb')
-rw-r--r--activerecord/test/cases/validations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb
index ba2fb04d2f..27a42bcd03 100644
--- a/activerecord/test/cases/validations_test.rb
+++ b/activerecord/test/cases/validations_test.rb
@@ -129,4 +129,16 @@ class ValidationsTest < ActiveRecord::TestCase
assert_equal 100, d.salary
assert_equal "100,000", d.salary_before_type_cast
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
+
+ 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]
+ end
end