From 11b24ab64bb58b423e39ef94eea309db87d45ce8 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 18 May 2013 23:06:53 +0000 Subject: [PATCH] replace non ASCII literal to hexadecimal at ApplicationHelperTest git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11878 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/helpers/application_helper_test.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index dedf9900a..d4b030d0a 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -34,6 +34,10 @@ class ApplicationHelperTest < ActionView::TestCase def setup super set_tmp_attachments_directory + @russian_test = "\xd1\x82\xd0\xb5\xd1\x81\xd1\x82" + if @russian_test.respond_to?(:force_encoding) + @russian_test.force_encoding('UTF-8') + end end test "#link_to_if_authorized for authorized user should allow using the :controller and :action for the target link" do @@ -97,7 +101,8 @@ class ApplicationHelperTest < ActionView::TestCase if 'ruby'.respond_to?(:encoding) def test_auto_links_with_non_ascii_characters to_test = { - 'http://foo.bar/тест' => 'http://foo.bar/тест' + "http://foo.bar/#{@russian_test}" => + %|http://foo.bar/#{@russian_test}| } to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end @@ -251,7 +256,8 @@ RAW if 'ruby'.respond_to?(:encoding) def test_textile_external_links_with_non_ascii_characters to_test = { - 'This is a "link":http://foo.bar/тест' => 'This is a link' + %|This is a "link":http://foo.bar/#{@russian_test}| => + %|This is a link| } to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end @@ -587,6 +593,7 @@ RAW end def test_wiki_links + russian_eacape = CGI.escape(@russian_test) to_test = { '[[CookBook documentation]]' => 'CookBook documentation', '[[Another page|Page]]' => 'Page', @@ -597,7 +604,8 @@ RAW '[[CookBook documentation#One-section]]' => 'CookBook documentation', '[[Another page#anchor|Page]]' => 'Page', # UTF8 anchor - '[[Another_page#Тест|Тест]]' => %|Тест|, + "[[Another_page##{@russian_test}|#{@russian_test}]]" => + %|#{@russian_test}|, # page that doesn't exist '[[Unknown page]]' => 'Unknown page', '[[Unknown page|404]]' => '404', -- 2.39.5