aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorJuan Broullon <juan.broullon@shopify.com>2018-07-03 11:50:02 -0400
committerJuan Broullon <juan.broullon@shopify.com>2018-07-03 11:50:02 -0400
commit42c353705abf133b76dd989bb477af449db8f9fb (patch)
treef59493fec950b7f5e2f33007fd9ba0c55c6428f6 /actionview/test
parent242ae67ebe98685464b8f23f527e2102dfc3df88 (diff)
downloadrails-42c353705abf133b76dd989bb477af449db8f9fb.tar.gz
rails-42c353705abf133b76dd989bb477af449db8f9fb.tar.bz2
rails-42c353705abf133b76dd989bb477af449db8f9fb.zip
Add safe html support to arrays of translations
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/translation_helper_test.rb7
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 &lt;One&gt;</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