From f53a6d814966e0ea039bde680b0fc3814236641c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 24 May 2010 20:16:50 -0700 Subject: i18n: t() handles single keys returning an Array, also --- actionpack/test/template/translation_helper_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb index 89acdc9dd3..1be418a206 100644 --- a/actionpack/test/template/translation_helper_test.rb +++ b/actionpack/test/template/translation_helper_test.rb @@ -18,6 +18,11 @@ class TranslationHelperTest < ActiveSupport::TestCase assert_equal expected, translate(:foo) end + def test_translation_returning_an_array + I18n.expects(:translate).with(:foo, :raise => true).returns(["foo", "bar"]) + assert_equal ["foo", "bar"], translate(:foo) + end + def test_delegates_localize_to_i18n @time = Time.utc(2008, 7, 8, 12, 18, 38) I18n.expects(:localize).with(@time) @@ -50,4 +55,9 @@ class TranslationHelperTest < ActiveSupport::TestCase I18n.expects(:translate).with("hello_html", :raise => true).returns("Hello World") assert translate("hello_html").html_safe? end + + def test_translation_returning_an_array_ignores_html_suffix + I18n.expects(:translate).with(:foo_html, :raise => true).returns(["foo", "bar"]) + assert_equal ["foo", "bar"], translate(:foo_html) + end end -- cgit v1.2.3