@@ -34,6 +34,10 class ApplicationHelperTest < ActionView::TestCase | |||
|
34 | 34 | def setup |
|
35 | 35 | super |
|
36 | 36 | set_tmp_attachments_directory |
|
37 | @russian_test = "\xd1\x82\xd0\xb5\xd1\x81\xd1\x82" | |
|
38 | if @russian_test.respond_to?(:force_encoding) | |
|
39 | @russian_test.force_encoding('UTF-8') | |
|
40 | end | |
|
37 | 41 | end |
|
38 | 42 | |
|
39 | 43 | 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 | |||
|
97 | 101 | if 'ruby'.respond_to?(:encoding) |
|
98 | 102 | def test_auto_links_with_non_ascii_characters |
|
99 | 103 | to_test = { |
|
100 | 'http://foo.bar/тест' => '<a class="external" href="http://foo.bar/тест">http://foo.bar/тест</a>' | |
|
104 | "http://foo.bar/#{@russian_test}" => | |
|
105 | %|<a class="external" href="http://foo.bar/#{@russian_test}">http://foo.bar/#{@russian_test}</a>| | |
|
101 | 106 | } |
|
102 | 107 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
103 | 108 | end |
@@ -251,7 +256,8 RAW | |||
|
251 | 256 | if 'ruby'.respond_to?(:encoding) |
|
252 | 257 | def test_textile_external_links_with_non_ascii_characters |
|
253 | 258 | to_test = { |
|
254 | 'This is a "link":http://foo.bar/тест' => 'This is a <a href="http://foo.bar/тест" class="external">link</a>' | |
|
259 | %|This is a "link":http://foo.bar/#{@russian_test}| => | |
|
260 | %|This is a <a href="http://foo.bar/#{@russian_test}" class="external">link</a>| | |
|
255 | 261 | } |
|
256 | 262 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
257 | 263 | end |
@@ -587,6 +593,7 RAW | |||
|
587 | 593 | end |
|
588 | 594 | |
|
589 | 595 | def test_wiki_links |
|
596 | russian_eacape = CGI.escape(@russian_test) | |
|
590 | 597 | to_test = { |
|
591 | 598 | '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', |
|
592 | 599 | '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>', |
@@ -597,7 +604,8 RAW | |||
|
597 | 604 | '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>', |
|
598 | 605 | '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>', |
|
599 | 606 | # UTF8 anchor |
|
600 | '[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page##{CGI.escape 'Тест'}" class="wiki-page">Тест</a>|, | |
|
607 | "[[Another_page##{@russian_test}|#{@russian_test}]]" => | |
|
608 | %|<a href="/projects/ecookbook/wiki/Another_page##{russian_eacape}" class="wiki-page">#{@russian_test}</a>|, | |
|
601 | 609 | # page that doesn't exist |
|
602 | 610 | '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>', |
|
603 | 611 | '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>', |
General Comments 0
You need to be logged in to leave comments.
Login now