aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/validations_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 11:24:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-25 11:24:43 +0000
commit3eed3272d7fc79040b6eb3b8586be0d8875d8203 (patch)
tree6bf65567604faaded9a402b3a6307f96c6bae9b4 /activerecord/test/validations_test.rb
parent55850818e36dce98061c3bbc56b41134f8f0e413 (diff)
downloadrails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.tar.gz
rails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.tar.bz2
rails-3eed3272d7fc79040b6eb3b8586be0d8875d8203.zip
Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/validations_test.rb')
-rwxr-xr-xactiverecord/test/validations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb
index 2cce21597a..2ff618b0e6 100755
--- a/activerecord/test/validations_test.rb
+++ b/activerecord/test/validations_test.rb
@@ -493,6 +493,15 @@ class ValidationsTest < Test::Unit::TestCase
end
end
+ def test_validates_length_with_globaly_modified_error_message
+ ActiveRecord::Errors.default_error_messages[:too_short] = 'tu est trops petit hombre %d'
+ 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
+
def test_validates_size_of_association
assert_nothing_raised { Topic.validates_size_of :replies, :minimum => 1 }
t = Topic.new('title' => 'noreplies', 'content' => 'whatever')