Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #6433 from parndt/fix_typo

Fixed typo new_defautls -> new_defaults.
  • Loading branch information...
commit 5089d65f43c1e5933f904121b92c4b6bb5422164 2 parents 7c69e2d + 40c0b3a
@rafaelfranca rafaelfranca authored
View
4 actionpack/lib/action_view/helpers/translation_helper.rb
@@ -64,7 +64,7 @@ def translate(key, options = {})
# Delegates to <tt>I18n.localize</tt> with no additional functionality.
#
- # See http://rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize
+ # See http://rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize
# for more information.
def localize(*args)
I18n.localize(*args)
@@ -96,7 +96,7 @@ def wrap_translate_defaults(defaults)
new_defaults << lambda { |_, options| translate key, options.merge(:default => defaults) }
break
else
- new_defautls << key
+ new_defaults << key
end
end
View
16 actionpack/test/template/translation_helper_test.rb
@@ -111,18 +111,28 @@ def test_translation_returning_an_array_ignores_html_suffix
def test_translate_with_default_named_html
translation = translate(:'translations.missing', :default => :'translations.hello_html')
assert_equal '<a>Hello World</a>', translation
- assert translation.html_safe?
+ assert_equal true, translation.html_safe?
end
def test_translate_with_two_defaults_named_html
translation = translate(:'translations.missing', :default => [:'translations.missing_html', :'translations.hello_html'])
assert_equal '<a>Hello World</a>', translation
- assert translation.html_safe?
+ assert_equal true, translation.html_safe?
end
def test_translate_with_last_default_named_html
translation = translate(:'translations.missing', :default => [:'translations.missing', :'translations.hello_html'])
assert_equal '<a>Hello World</a>', translation
- assert translation.html_safe?
+ assert_equal true, translation.html_safe?
+ end
+
+ def test_translate_with_string_default
+ translation = translate(:'translations.missing', default: 'A Generic String')
+ assert_equal 'A Generic String', 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
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.