aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/validations_test.rb
diff options
context:
space:
mode:
authorJohn D. Hume <duelin.markers@gmail.com>2008-05-28 23:35:56 -0400
committerMichael Koziarski <michael@koziarski.com>2008-05-31 16:59:03 -0700
commitf6e921f9568d7f2e4807edf8728e6b0df8991816 (patch)
tree87d6b37a4ccdfffbc26a7ac6b9f5ef1470d9c073 /activerecord/test/cases/validations_test.rb
parentef0ea782b1f5cf7b08e74ea3002a16c708f66645 (diff)
downloadrails-f6e921f9568d7f2e4807edf8728e6b0df8991816.tar.gz
rails-f6e921f9568d7f2e4807edf8728e6b0df8991816.tar.bz2
rails-f6e921f9568d7f2e4807edf8728e6b0df8991816.zip
Substitute value into validates_format_of message
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/test/cases/validations_test.rb')
-rwxr-xr-xactiverecord/test/cases/validations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb
index a4d9da4806..7b71647d25 100755
--- a/activerecord/test/cases/validations_test.rb
+++ b/activerecord/test/cases/validations_test.rb
@@ -583,6 +583,12 @@ class ValidationsTest < ActiveRecord::TestCase
assert_nil t.errors.on(:title)
end
+ def test_validate_format_with_formatted_message
+ Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be %s")
+ t = Topic.create(:title => 'Invalid title')
+ assert_equal "can't be Invalid title", t.errors.on(:title)
+ end
+
def test_validates_inclusion_of
Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ) )