Skip to content

Instantly share code, notes, and snippets.

@svenfuchs
Forked from spastorino/gist:1027174
Created June 15, 2011 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenfuchs/1027175 to your computer and use it in GitHub Desktop.
Save svenfuchs/1027175 to your computer and use it in GitHub Desktop.
i18n.patch
diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb
index cd9f54e..365841e 100644
--- a/actionpack/test/template/translation_helper_test.rb
+++ b/actionpack/test/template/translation_helper_test.rb
@@ -53,6 +53,12 @@ class TranslationHelperTest < ActiveSupport::TestCase
assert_equal false, I18n.translate(:"translations.missing").html_safe?
end
+ def test_i18n_translate_returns_unsafe_even_if_using_html_rescue_format
+ expected = '<span class="translation_missing" title="translation missing: en.translations.missing">Missing</span>'
+ assert_equal expected, I18n.translate(:"translations.missing", :rescue_format => :html)
+ assert_equal false, I18n.translate(:"translations.missing", :rescue_format => :html).html_safe?
+ end
+
def test_translation_returning_an_array
expected = %w(foo bar)
assert_equal expected, translate(:"translations.array")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment