aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-05-22 18:56:23 +1200
committerPhilip Arndt <parndt@gmail.com>2012-05-23 11:04:15 +1200
commit40c0b3a25d901247c51f92c5f295b229b4c61965 (patch)
tree55150234e8188050e39580029251233ce1d3d290 /actionpack/test
parentd22859ed9712cfa27b83225d8363d0f92261335a (diff)
downloadrails-40c0b3a25d901247c51f92c5f295b229b4c61965.tar.gz
rails-40c0b3a25d901247c51f92c5f295b229b4c61965.tar.bz2
rails-40c0b3a25d901247c51f92c5f295b229b4c61965.zip
Fixed typo new_defautls -> new_defaults.
* Added tests for 'else' case in ActionView::Helpers::TranslationHelper#wrap_translate_defaults * Also updated the testing syntax of translation.html_safe? asserts to provide better output upon failure.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/translation_helper_test.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb
index 97777ccff0..d496dbb35e 100644
--- a/actionpack/test/template/translation_helper_test.rb
+++ b/actionpack/test/template/translation_helper_test.rb
@@ -111,18 +111,28 @@ class TranslationHelperTest < ActiveSupport::TestCase
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