Permalink
Browse files

Merge pull request #15068 from josepjaume/patch-1

Dup options hash to prevent modifications
  • Loading branch information...
2 parents 6470f37 + 6caf3ab commit f0f7c4ff96ad8223430e9ee13ca1bb25732e13e7 @tenderlove tenderlove committed May 13, 2014
@@ -34,6 +34,8 @@ module TranslationHelper
# naming convention helps to identify translations that include HTML tags so that
# you know what kind of output to expect when you call translate in a template.
def translate(key, options = {})
+ options = options.dup
+
options[:default] = wrap_translate_defaults(options[:default]) if options[:default]
# If the user has specified rescue_format then pass it all through, otherwise use
@@ -151,4 +151,10 @@ def test_translate_with_array_of_string_defaults
translation = translate(:'translations.missing', default: ['A Generic String', 'Second generic string'])
assert_equal 'A Generic String', translation
end
+
+ def test_translate_doesnt_change_options
+ options = {}
+ translate(:'translations.missing', options)
+ assert_equal options, {}
+ end
end

0 comments on commit f0f7c4f

Please sign in to comment.