aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/translation_helper_test.rb
diff options
context:
space:
mode:
authorUlisses Almeida <anizark@gmail.com>2015-02-26 18:18:58 -0300
committerUlisses Almeida <anizark@gmail.com>2015-02-26 19:04:00 -0300
commit362557eb4169a541063468b489931648665f1fa3 (patch)
tree585f548cbe42c481cd8dd70e42139a9314b00fac /actionview/test/template/translation_helper_test.rb
parent38218929e9b3205a2a731660b3c5527937e1c015 (diff)
downloadrails-362557eb4169a541063468b489931648665f1fa3.tar.gz
rails-362557eb4169a541063468b489931648665f1fa3.tar.bz2
rails-362557eb4169a541063468b489931648665f1fa3.zip
Fix regression when passing a value different of String.
The previous version of rails(4.2.0) you can pass objects to the default option of translation helper. For example: ```ruby t('foo', default: 1) ``` But on rails 4.2.1 version this kind of use stopped to work, because started only to accept String types. Now with this fix we can use orther value types on this helper again.
Diffstat (limited to 'actionview/test/template/translation_helper_test.rb')
-rw-r--r--actionview/test/template/translation_helper_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb
index 8fde478ac9..ef4d13efa7 100644
--- a/actionview/test/template/translation_helper_test.rb
+++ b/actionview/test/template/translation_helper_test.rb
@@ -180,6 +180,11 @@ class TranslationHelperTest < ActiveSupport::TestCase
assert_equal 'A Generic String', translation
end
+ def test_translate_with_object_default
+ translation = translate(:'translations.missing', default: 123)
+ assert_equal 123, translation
+ end
+
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