Skip to content

Commit

Permalink
add activerecord tests to make sure the deprecated %s and %d interpol…
Browse files Browse the repository at this point in the history
…ation syntax still works

[#1016 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
Sven Fuchs authored and jeremy committed Sep 11, 2008
1 parent 31dcd78 commit e826c99
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion activerecord/test/cases/validations_i18n_test.rb
Expand Up @@ -40,15 +40,29 @@ def test_default_error_messages_is_deprecated
end
end

def test_percent_s_interpolation_syntax_in_error_messages_still_works
ActiveSupport::Deprecation.silence do
result = I18n.t :does_not_exist, :default => "%s interpolation syntax is deprecated", :value => 'this'
assert_equal result, "this interpolation syntax is deprecated"
end
end

def test_percent_s_interpolation_syntax_in_error_messages_is_deprecated
assert_deprecated('using %s in messages') do
I18n.t :does_not_exist, :default => "%s interpolation syntax is deprected", :value => 'this'
end
end

def test_percent_d_interpolation_syntax_in_error_messages_still_works
ActiveSupport::Deprecation.silence do
result = I18n.t :does_not_exist, :default => "%d interpolation syntaxes are deprecated", :count => 2
assert_equal result, "2 interpolation syntaxes are deprecated"
end
end

def test_percent_d_interpolation_syntax_in_error_messages_is_deprecated
assert_deprecated('using %d in messages') do
I18n.t :does_not_exist, :default => "%d interpolation syntax is deprected", :count => 1
I18n.t :does_not_exist, :default => "%d interpolation syntaxes are deprected", :count => 2
end
end

Expand Down

0 comments on commit e826c99

Please sign in to comment.