diff options
author | Justin Coyne <justin@curationexperts.com> | 2015-01-02 17:07:01 -0600 |
---|---|---|
committer | Justin Coyne <justin@curationexperts.com> | 2015-01-02 17:07:01 -0600 |
commit | fab50c130baf482288d510427a6632e6489a55d6 (patch) | |
tree | ad8adb4db3bd92ea4f181b82697c772d005c8d4f /actionview/test | |
parent | 4b04fc0528d7ffa3943a92a854d2b882419508a8 (diff) | |
download | rails-fab50c130baf482288d510427a6632e6489a55d6.tar.gz rails-fab50c130baf482288d510427a6632e6489a55d6.tar.bz2 rails-fab50c130baf482288d510427a6632e6489a55d6.zip |
Unsafe default translations should not be marked html_safe
Previously default translation keys that didn't end in `_html`, but came
after a missing key that ended in `_html` were being returned as
html_safe. Now they are not. Fixes #18257
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/translation_helper_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index 362f05ea70..dea861c0e5 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -145,6 +145,12 @@ class TranslationHelperTest < ActiveSupport::TestCase assert_equal true, translation.html_safe? end + def test_translate_with_last_default_not_named_html + translation = translate(:'translations.missing', :default => [:'translations.missing_html', :'translations.foo']) + assert_equal 'Foo', translation + assert_equal false, translation.html_safe? + end + def test_translate_with_string_default translation = translate(:'translations.missing', default: 'A Generic String') assert_equal 'A Generic String', translation |