Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change all i18n interpolations from {{...}} to %{...}

This will silent all warning if there's a i18n version 0.4.x gem install on user's machine.

[#4913 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 5ed6a8447b1c9191feb431e1387f28abde7eba44 1 parent 54a5088
@sikachu sikachu authored josevalim committed
View
28 actionpack/lib/action_view/locale/en.yml
@@ -63,37 +63,37 @@
half_a_minute: "half a minute"
less_than_x_seconds:
one: "less than 1 second"
- other: "less than {{count}} seconds"
+ other: "less than %{count} seconds"
x_seconds:
one: "1 second"
- other: "{{count}} seconds"
+ other: "%{count} seconds"
less_than_x_minutes:
one: "less than a minute"
- other: "less than {{count}} minutes"
+ other: "less than %{count} minutes"
x_minutes:
one: "1 minute"
- other: "{{count}} minutes"
+ other: "%{count} minutes"
about_x_hours:
one: "about 1 hour"
- other: "about {{count}} hours"
+ other: "about %{count} hours"
x_days:
one: "1 day"
- other: "{{count}} days"
+ other: "%{count} days"
about_x_months:
one: "about 1 month"
- other: "about {{count}} months"
+ other: "about %{count} months"
x_months:
one: "1 month"
- other: "{{count}} months"
+ other: "%{count} months"
about_x_years:
one: "about 1 year"
- other: "about {{count}} years"
+ other: "about %{count} years"
over_x_years:
one: "over 1 year"
- other: "over {{count}} years"
+ other: "over %{count} years"
almost_x_years:
one: "almost 1 year"
- other: "almost {{count}} years"
+ other: "almost %{count} years"
prompts:
year: "Year"
month: "Month"
@@ -106,12 +106,12 @@
errors:
template:
header:
- one: "1 error prohibited this {{model}} from being saved"
- other: "{{count}} errors prohibited this {{model}} from being saved"
+ one: "1 error prohibited this %{model} from being saved"
+ other: "%{count} errors prohibited this %{model} from being saved"
# The variable :count is also available
body: "There were problems with the following fields:"
support:
select:
# default value for :prompt => true in FormOptionsHelper
- prompt: "Please select"
+ prompt: "Please select"
View
22 activerecord/lib/active_record/locale/en.yml
@@ -11,23 +11,23 @@ en:
accepted: "must be accepted"
empty: "can't be empty"
blank: "can't be blank"
- too_long: "is too long (maximum is {{count}} characters)"
- too_short: "is too short (minimum is {{count}} characters)"
- wrong_length: "is the wrong length (should be {{count}} characters)"
+ too_long: "is too long (maximum is %{count} characters)"
+ too_short: "is too short (minimum is %{count} characters)"
+ wrong_length: "is the wrong length (should be %{count} characters)"
taken: "has already been taken"
not_a_number: "is not a number"
- greater_than: "must be greater than {{count}}"
- greater_than_or_equal_to: "must be greater than or equal to {{count}}"
- equal_to: "must be equal to {{count}}"
- less_than: "must be less than {{count}}"
- less_than_or_equal_to: "must be less than or equal to {{count}}"
+ greater_than: "must be greater than %{count}"
+ greater_than_or_equal_to: "must be greater than or equal to %{count}"
+ equal_to: "must be equal to %{count}"
+ less_than: "must be less than %{count}"
+ less_than_or_equal_to: "must be less than or equal to %{count}"
odd: "must be odd"
even: "must be even"
- record_invalid: "Validation failed: {{errors}}"
+ record_invalid: "Validation failed: %{errors}"
# Append your own errors here or at the model/attributes scope.
full_messages:
- format: "{{attribute}} {{message}}"
+ format: "%{attribute} %{message}"
# You can define own errors for models or model attributes.
# The values :model, :attribute and :value are always available for interpolation.
@@ -35,7 +35,7 @@ en:
# For example,
# models:
# user:
- # blank: "This is a custom blank message for {{model}}: {{attribute}}"
+ # blank: "This is a custom blank message for %{model}: %{attribute}"
# attributes:
# login:
# blank: "This is a custom blank message for User login"
View
22 activerecord/lib/active_record/validations.rb
@@ -80,7 +80,7 @@ def generate_message(options = {})
# Wraps an error message into a full_message format.
#
- # The default full_message format for any locale is <tt>"{{attribute}} {{message}}"</tt>.
+ # The default full_message format for any locale is <tt>"%{attribute} %{message}"</tt>.
# One can specify locale specific default full_message format by storing it as a
# translation for the key <tt>:"activerecord.errors.full_messages.format"</tt>.
#
@@ -109,7 +109,7 @@ def generate_full_message(options = {})
keys = [
:"full_messages.#{@message}",
:'full_messages.format',
- '{{attribute}} {{message}}'
+ '%{attribute} %{message}'
]
options.merge!(:default => keys, :message => self.message)
@@ -604,13 +604,13 @@ def validates_presence_of(*attr_names)
#
# class Person < ActiveRecord::Base
# validates_length_of :first_name, :maximum=>30
- # validates_length_of :last_name, :maximum=>30, :message=>"less than {{count}} if you don't mind"
+ # validates_length_of :last_name, :maximum=>30, :message=>"less than %{count} if you don't mind"
# validates_length_of :fax, :in => 7..32, :allow_nil => true
# validates_length_of :phone, :in => 7..32, :allow_blank => true
# validates_length_of :user_name, :within => 6..20, :too_long => "pick a shorter name", :too_short => "pick a longer name"
- # validates_length_of :fav_bra_size, :minimum => 1, :too_short => "please enter at least {{count}} character"
- # validates_length_of :smurf_leader, :is => 4, :message => "papa is spelled with {{count}} characters... don't play me."
- # validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least {{count}} words."), :tokenizer => lambda {|str| str.scan(/\w+/) }
+ # validates_length_of :fav_bra_size, :minimum => 1, :too_short => "please enter at least %{count} character"
+ # validates_length_of :smurf_leader, :is => 4, :message => "papa is spelled with %{count} characters... don't play me."
+ # validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least %{count} words."), :tokenizer => lambda {|str| str.scan(/\w+/) }
# end
#
# Configuration options:
@@ -621,9 +621,9 @@ def validates_presence_of(*attr_names)
# * <tt>:in</tt> - A synonym(or alias) for <tt>:within</tt>.
# * <tt>:allow_nil</tt> - Attribute may be +nil+; skip validation.
# * <tt>:allow_blank</tt> - Attribute may be blank; skip validation.
- # * <tt>:too_long</tt> - The error message if the attribute goes over the maximum (default is: "is too long (maximum is {{count}} characters)").
- # * <tt>:too_short</tt> - The error message if the attribute goes under the minimum (default is: "is too short (min is {{count}} characters)").
- # * <tt>:wrong_length</tt> - The error message if using the <tt>:is</tt> method and the attribute is the wrong size (default is: "is the wrong length (should be {{count}} characters)").
+ # * <tt>:too_long</tt> - The error message if the attribute goes over the maximum (default is: "is too long (maximum is %{count} characters)").
+ # * <tt>:too_short</tt> - The error message if the attribute goes under the minimum (default is: "is too short (min is %{count} characters)").
+ # * <tt>:wrong_length</tt> - The error message if using the <tt>:is</tt> method and the attribute is the wrong size (default is: "is the wrong length (should be %{count} characters)").
# * <tt>:message</tt> - The error message to use for a <tt>:minimum</tt>, <tt>:maximum</tt>, or <tt>:is</tt> violation. An alias of the appropriate <tt>too_long</tt>/<tt>too_short</tt>/<tt>wrong_length</tt> message.
# * <tt>:on</tt> - Specifies when this validation is active (default is <tt>:save</tt>, other options <tt>:create</tt>, <tt>:update</tt>).
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine if the validation should
@@ -885,7 +885,7 @@ def validates_format_of(*attr_names)
# class Person < ActiveRecord::Base
# validates_inclusion_of :gender, :in => %w( m f )
# validates_inclusion_of :age, :in => 0..99
- # validates_inclusion_of :format, :in => %w( jpg gif png ), :message => "extension {{value}} is not included in the list"
+ # validates_inclusion_of :format, :in => %w( jpg gif png ), :message => "extension %{value} is not included in the list"
# end
#
# Configuration options:
@@ -919,7 +919,7 @@ def validates_inclusion_of(*attr_names)
# class Person < ActiveRecord::Base
# validates_exclusion_of :username, :in => %w( admin superuser ), :message => "You don't belong here"
# validates_exclusion_of :age, :in => 30..60, :message => "This site is only for under 30 and over 60"
- # validates_exclusion_of :format, :in => %w( mov avi ), :message => "extension {{value}} is not allowed"
+ # validates_exclusion_of :format, :in => %w( mov avi ), :message => "extension %{value} is not allowed"
# end
#
# Configuration options:
View
24 activerecord/test/cases/validations_i18n_test.rb
@@ -486,20 +486,20 @@ def assert_full_message(message, *args)
end
test ":default is only given to message if a symbol is supplied" do
- store_translations(:errors => { :messages => { :"foo bar" => "You fooed: {{value}}." } })
+ store_translations(:errors => { :messages => { :"foo bar" => "You fooed: %{value}." } })
@reply.errors.add(:title, :inexistent, :default => "foo bar")
assert_equal "foo bar", @reply.errors[:title]
end
test "#generate_message passes the model attribute value for interpolation" do
- store_translations(:errors => { :messages => { :foo => "You fooed: {{value}}." } })
+ store_translations(:errors => { :messages => { :foo => "You fooed: %{value}." } })
@reply.title = "da title"
assert_error_message 'You fooed: da title.', :title, :foo
end
test "#generate_message passes the human_name of the model for interpolation" do
store_translations(
- :errors => { :messages => { :foo => "You fooed: {{model}}." } },
+ :errors => { :messages => { :foo => "You fooed: %{model}." } },
:models => { :topic => 'da topic' }
)
assert_error_message 'You fooed: da topic.', :title, :foo
@@ -507,7 +507,7 @@ def assert_full_message(message, *args)
test "#generate_message passes the human_name of the attribute for interpolation" do
store_translations(
- :errors => { :messages => { :foo => "You fooed: {{attribute}}." } },
+ :errors => { :messages => { :foo => "You fooed: %{attribute}." } },
:attributes => { :topic => { :title => 'da topic title' } }
)
assert_error_message 'You fooed: da topic title.', :title, :foo
@@ -607,17 +607,17 @@ def assert_full_message(message, *args)
end
test "#full_message with a format present" do
- store_translations(:errors => { :messages => { :kaputt => 'is kaputt' }, :full_messages => { :format => '{{attribute}}: {{message}}' } })
+ store_translations(:errors => { :messages => { :kaputt => 'is kaputt' }, :full_messages => { :format => '%{attribute}: %{message}' } })
assert_full_message 'Title: is kaputt', :title, :kaputt
end
test "#full_message with a type specific format present" do
- store_translations(:errors => { :messages => { :kaputt => 'is kaputt' }, :full_messages => { :kaputt => '{{attribute}} {{message}}!' } })
+ store_translations(:errors => { :messages => { :kaputt => 'is kaputt' }, :full_messages => { :kaputt => '%{attribute} %{message}!' } })
assert_full_message 'Title is kaputt!', :title, :kaputt
end
test "#full_message with class-level specified custom message" do
- store_translations(:errors => { :messages => { :broken => 'is kaputt' }, :full_messages => { :broken => '{{attribute}} {{message}}?!' } })
+ store_translations(:errors => { :messages => { :broken => 'is kaputt' }, :full_messages => { :broken => '%{attribute} %{message}?!' } })
assert_full_message 'Title is kaputt?!', :title, :kaputt, :message => :broken
end
@@ -625,7 +625,7 @@ def assert_full_message(message, *args)
store_translations(:my_errors => { :messages => { :kaputt => 'is kaputt' } })
assert_full_message 'Title is kaputt', :title, :kaputt, :scope => [:activerecord, :my_errors]
- store_translations(:my_errors => { :full_messages => { :kaputt => '{{attribute}} {{message}}!' } })
+ store_translations(:my_errors => { :full_messages => { :kaputt => '%{attribute} %{message}!' } })
assert_full_message 'Title is kaputt!', :title, :kaputt, :scope => [:activerecord, :my_errors]
end
@@ -763,7 +763,7 @@ def error_message(*args)
end
test "custom message string interpolation" do
- assert_equal 'custom message title', error_message(:invalid, :default => 'custom message {{value}}', :value => 'title')
+ assert_equal 'custom message title', error_message(:invalid, :default => 'custom message %{value}', :value => 'title')
end
end
@@ -897,14 +897,14 @@ def assert_full_message(message)
test "full_message format stored per custom error message key" do
assert_full_message("Name is broken!") do
- store_translations :errors => { :messages => { :broken => 'is broken' }, :full_messages => { :broken => '{{attribute}} {{message}}!' } }
+ store_translations :errors => { :messages => { :broken => 'is broken' }, :full_messages => { :broken => '%{attribute} %{message}!' } }
I18nPerson.validates_presence_of :name, :message => :broken
end
end
test "full_message format stored per error type" do
assert_full_message("Name can't be blank!") do
- store_translations :errors => { :full_messages => { :blank => '{{attribute}} {{message}}!' } }
+ store_translations :errors => { :full_messages => { :blank => '%{attribute} %{message}!' } }
I18nPerson.validates_presence_of :name
end
end
@@ -912,7 +912,7 @@ def assert_full_message(message)
test "full_message format stored as default" do
assert_full_message("Name: can't be blank") do
- store_translations :errors => { :full_messages => { :format => '{{attribute}}: {{message}}' } }
+ store_translations :errors => { :full_messages => { :format => '%{attribute}: %{message}' } }
I18nPerson.validates_presence_of :name
end
end
View
60 activerecord/test/cases/validations_test.rb
@@ -678,7 +678,7 @@ def test_validate_format_numeric
end
def test_validate_format_with_formatted_message
- Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be {{value}}")
+ Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be %{value}")
t = Topic.create(:title => 'Invalid title')
assert_equal "can't be Invalid title", t.errors.on(:title)
end
@@ -741,7 +741,7 @@ def test_validates_length_of_with_allow_blank
end
def test_validates_inclusion_of_with_formatted_message
- Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :message => "option {{value}} is not in the list" )
+ Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :message => "option %{value} is not in the list" )
assert Topic.create("title" => "a", "content" => "abc").valid?
@@ -768,7 +768,7 @@ def test_validates_exclusion_of
end
def test_validates_exclusion_of_with_formatted_message
- Topic.validates_exclusion_of( :title, :in => %w( abe monkey ), :message => "option {{value}} is restricted" )
+ Topic.validates_exclusion_of( :title, :in => %w( abe monkey ), :message => "option %{value} is restricted" )
assert Topic.create("title" => "something", "content" => "abc")
@@ -868,7 +868,7 @@ def test_optionally_validates_length_of_using_within
end
def test_optionally_validates_length_of_using_within_on_create
- Topic.validates_length_of :title, :content, :within => 5..10, :on => :create, :too_long => "my string is too long: {{count}}"
+ Topic.validates_length_of :title, :content, :within => 5..10, :on => :create, :too_long => "my string is too long: %{count}"
t = Topic.create("title" => "thisisnotvalid", "content" => "whatever")
assert !t.save
@@ -889,7 +889,7 @@ def test_optionally_validates_length_of_using_within_on_create
end
def test_optionally_validates_length_of_using_within_on_update
- Topic.validates_length_of :title, :content, :within => 5..10, :on => :update, :too_short => "my string is too short: {{count}}"
+ Topic.validates_length_of :title, :content, :within => 5..10, :on => :update, :too_short => "my string is too short: %{count}"
t = Topic.create("title" => "vali", "content" => "whatever")
assert !t.save
@@ -953,7 +953,7 @@ def test_validates_length_of_using_bignum
def test_validates_length_with_globally_modified_error_message
defaults = ActiveSupport::Deprecation.silence { ActiveRecord::Errors.default_error_messages }
original_message = defaults[:too_short]
- defaults[:too_short] = 'tu est trops petit hombre {{count}}'
+ defaults[:too_short] = 'tu est trops petit hombre %{count}'
Topic.validates_length_of :title, :minimum => 10
t = Topic.create(:title => 'too short')
@@ -1004,7 +1004,7 @@ def test_validates_length_of_nasty_params
end
def test_validates_length_of_custom_errors_for_minimum_with_message
- Topic.validates_length_of( :title, :minimum=>5, :message=>"boo {{count}}" )
+ Topic.validates_length_of( :title, :minimum=>5, :message=>"boo %{count}" )
t = Topic.create("title" => "uhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1012,7 +1012,7 @@ def test_validates_length_of_custom_errors_for_minimum_with_message
end
def test_validates_length_of_custom_errors_for_minimum_with_too_short
- Topic.validates_length_of( :title, :minimum=>5, :too_short=>"hoo {{count}}" )
+ Topic.validates_length_of( :title, :minimum=>5, :too_short=>"hoo %{count}" )
t = Topic.create("title" => "uhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1020,7 +1020,7 @@ def test_validates_length_of_custom_errors_for_minimum_with_too_short
end
def test_validates_length_of_custom_errors_for_maximum_with_message
- Topic.validates_length_of( :title, :maximum=>5, :message=>"boo {{count}}" )
+ Topic.validates_length_of( :title, :maximum=>5, :message=>"boo %{count}" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1028,7 +1028,7 @@ def test_validates_length_of_custom_errors_for_maximum_with_message
end
def test_validates_length_of_custom_errors_for_in
- Topic.validates_length_of(:title, :in => 10..20, :message => "hoo {{count}}")
+ Topic.validates_length_of(:title, :in => 10..20, :message => "hoo %{count}")
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1041,7 +1041,7 @@ def test_validates_length_of_custom_errors_for_in
end
def test_validates_length_of_custom_errors_for_maximum_with_too_long
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}" )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1049,7 +1049,7 @@ def test_validates_length_of_custom_errors_for_maximum_with_too_long
end
def test_validates_length_of_custom_errors_for_is_with_message
- Topic.validates_length_of( :title, :is=>5, :message=>"boo {{count}}" )
+ Topic.validates_length_of( :title, :is=>5, :message=>"boo %{count}" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1057,7 +1057,7 @@ def test_validates_length_of_custom_errors_for_is_with_message
end
def test_validates_length_of_custom_errors_for_is_with_wrong_length
- Topic.validates_length_of( :title, :is=>5, :wrong_length=>"hoo {{count}}" )
+ Topic.validates_length_of( :title, :is=>5, :wrong_length=>"hoo %{count}" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1123,7 +1123,7 @@ def test_optionally_validates_length_of_using_within_utf8
def test_optionally_validates_length_of_using_within_on_create_utf8
with_kcode('UTF8') do
- Topic.validates_length_of :title, :within => 5..10, :on => :create, :too_long => "長すぎます: {{count}}"
+ Topic.validates_length_of :title, :within => 5..10, :on => :create, :too_long => "長すぎます: %{count}"
t = Topic.create("title" => "一二三四五六七八九十A", "content" => "whatever")
assert !t.save
@@ -1146,7 +1146,7 @@ def test_optionally_validates_length_of_using_within_on_create_utf8
def test_optionally_validates_length_of_using_within_on_update_utf8
with_kcode('UTF8') do
- Topic.validates_length_of :title, :within => 5..10, :on => :update, :too_short => "短すぎます: {{count}}"
+ Topic.validates_length_of :title, :within => 5..10, :on => :update, :too_short => "短すぎます: %{count}"
t = Topic.create("title" => "一二三4", "content" => "whatever")
assert !t.save
@@ -1181,7 +1181,7 @@ def test_validates_length_of_using_is_utf8
end
def test_validates_length_of_with_block
- Topic.validates_length_of :content, :minimum => 5, :too_short=>"Your essay must be at least {{count}} words.",
+ Topic.validates_length_of :content, :minimum => 5, :too_short=>"Your essay must be at least %{count} words.",
:tokenizer => lambda {|str| str.scan(/\w+/) }
t = Topic.create!(:content => "this content should be long enough")
assert t.valid?
@@ -1356,7 +1356,7 @@ def test_validates_associated_with_custom_message_using_quotes
def test_if_validation_using_method_true
# When the method returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => :condition_is_true )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => :condition_is_true )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1365,7 +1365,7 @@ def test_if_validation_using_method_true
def test_unless_validation_using_method_true
# When the method returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => :condition_is_true )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => :condition_is_true )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
assert !t.errors.on(:title)
@@ -1373,7 +1373,7 @@ def test_unless_validation_using_method_true
def test_if_validation_using_method_false
# When the method returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => :condition_is_true_but_its_not )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => :condition_is_true_but_its_not )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
assert !t.errors.on(:title)
@@ -1381,7 +1381,7 @@ def test_if_validation_using_method_false
def test_unless_validation_using_method_false
# When the method returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => :condition_is_true_but_its_not )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => :condition_is_true_but_its_not )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1390,7 +1390,7 @@ def test_unless_validation_using_method_false
def test_if_validation_using_string_true
# When the evaluated string returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => "a = 1; a == 1" )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => "a = 1; a == 1" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1399,7 +1399,7 @@ def test_if_validation_using_string_true
def test_unless_validation_using_string_true
# When the evaluated string returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => "a = 1; a == 1" )
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => "a = 1; a == 1" )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
assert !t.errors.on(:title)
@@ -1407,7 +1407,7 @@ def test_unless_validation_using_string_true
def test_if_validation_using_string_false
# When the evaluated string returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :if => "false")
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => "false")
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
assert !t.errors.on(:title)
@@ -1415,7 +1415,7 @@ def test_if_validation_using_string_false
def test_unless_validation_using_string_false
# When the evaluated string returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}", :unless => "false")
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => "false")
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
assert t.errors.on(:title)
@@ -1424,7 +1424,7 @@ def test_unless_validation_using_string_false
def test_if_validation_using_block_true
# When the block returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
:if => Proc.new { |r| r.content.size > 4 } )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
@@ -1434,7 +1434,7 @@ def test_if_validation_using_block_true
def test_unless_validation_using_block_true
# When the block returns true
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
:unless => Proc.new { |r| r.content.size > 4 } )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
@@ -1443,7 +1443,7 @@ def test_unless_validation_using_block_true
def test_if_validation_using_block_false
# When the block returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
:if => Proc.new { |r| r.title != "uhohuhoh"} )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert t.valid?
@@ -1452,7 +1452,7 @@ def test_if_validation_using_block_false
def test_unless_validation_using_block_false
# When the block returns false
- Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo {{count}}",
+ Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
:unless => Proc.new { |r| r.title != "uhohuhoh"} )
t = Topic.create("title" => "uhohuhoh", "content" => "whatever")
assert !t.valid?
@@ -1634,13 +1634,13 @@ def test_validates_numericality_with_greater_than_less_than_and_even
end
def test_validates_numericality_with_numeric_message
- Topic.validates_numericality_of :approved, :less_than => 4, :message => "smaller than {{count}}"
+ Topic.validates_numericality_of :approved, :less_than => 4, :message => "smaller than %{count}"
topic = Topic.new("title" => "numeric test", "approved" => 10)
assert !topic.valid?
assert_equal "smaller than 4", topic.errors.on(:approved)
- Topic.validates_numericality_of :approved, :greater_than => 4, :message => "greater than {{count}}"
+ Topic.validates_numericality_of :approved, :greater_than => 4, :message => "greater than %{count}"
topic = Topic.new("title" => "numeric test", "approved" => 1)
assert !topic.valid?
Please sign in to comment.
Something went wrong with that request. Please try again.