aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/translation_helper_test.rb
diff options
context:
space:
mode:
authorJosep Jaume Rey <josepjaume@gmail.com>2014-05-12 17:20:51 +0200
committerJosep Jaume Rey <josepjaume@gmail.com>2014-05-13 14:13:36 +0200
commit6caf3ab51b422e08135cbfbdaeedb94b1f6c312c (patch)
tree9462b0d623f0a52cca3316c0bd6c00f126b8e925 /actionview/test/template/translation_helper_test.rb
parent711af752342cdd558f5f82d407d0d56a115bb8bc (diff)
downloadrails-6caf3ab51b422e08135cbfbdaeedb94b1f6c312c.tar.gz
rails-6caf3ab51b422e08135cbfbdaeedb94b1f6c312c.tar.bz2
rails-6caf3ab51b422e08135cbfbdaeedb94b1f6c312c.zip
Dup options hash to prevent modifications
`options[:default]` and `options[:raise]` can be mistakenly added to the `options` hash. This can be a problem if you're reusing the same object.
Diffstat (limited to 'actionview/test/template/translation_helper_test.rb')
-rw-r--r--actionview/test/template/translation_helper_test.rb6
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 c4770840fb..f166668a60 100644
--- a/actionview/test/template/translation_helper_test.rb
+++ b/actionview/test/template/translation_helper_test.rb
@@ -151,4 +151,10 @@ class TranslationHelperTest < ActiveSupport::TestCase
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