From 6caf3ab51b422e08135cbfbdaeedb94b1f6c312c Mon Sep 17 00:00:00 2001 From: Josep Jaume Rey Date: Mon, 12 May 2014 17:20:51 +0200 Subject: 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. --- actionview/test/template/translation_helper_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionview/test') 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 -- cgit v1.2.3