diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-07-03 18:27:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 18:27:29 +0200 |
commit | a3a876f809cc7f7fde68f6d5c5c8e38132118386 (patch) | |
tree | a14e1c07f8ea66fb8b15115482c6c3ffbc2cc581 /actionview/test | |
parent | 16d0c74c5b17f6b795cba7e08b7a64a7b4d35ee6 (diff) | |
parent | 42c353705abf133b76dd989bb477af449db8f9fb (diff) | |
download | rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.tar.gz rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.tar.bz2 rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.zip |
Merge pull request #32361 from ph3t/safe-html-translation-arrays
Add safe html support to arrays of translations
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/translation_helper_test.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index f40595bf4d..e756348938 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -164,8 +164,11 @@ class TranslationHelperTest < ActiveSupport::TestCase assert_equal "<a>Other <One></a>", translate(:'translations.count_html', count: "<One>") end - def test_translation_returning_an_array_ignores_html_suffix - assert_equal ["foo", "bar"], translate(:'translations.array_html') + def test_translate_marks_array_of_translations_with_a_html_safe_suffix_as_safe_html + translate(:'translations.array_html').tap do |translated| + assert_equal %w( foo bar ), translated + assert translated.all?(&:html_safe?) + end end def test_translate_with_default_named_html |