@@ -34,6 +34,10 class ApplicationHelperTest < ActionView::TestCase | |||||
34 | def setup |
|
34 | def setup | |
35 | super |
|
35 | super | |
36 | set_tmp_attachments_directory |
|
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 | end |
|
41 | end | |
38 |
|
42 | |||
39 | test "#link_to_if_authorized for authorized user should allow using the :controller and :action for the target link" do |
|
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 | if 'ruby'.respond_to?(:encoding) |
|
101 | if 'ruby'.respond_to?(:encoding) | |
98 | def test_auto_links_with_non_ascii_characters |
|
102 | def test_auto_links_with_non_ascii_characters | |
99 | to_test = { |
|
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 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
107 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
103 | end |
|
108 | end | |
@@ -251,7 +256,8 RAW | |||||
251 | if 'ruby'.respond_to?(:encoding) |
|
256 | if 'ruby'.respond_to?(:encoding) | |
252 | def test_textile_external_links_with_non_ascii_characters |
|
257 | def test_textile_external_links_with_non_ascii_characters | |
253 | to_test = { |
|
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 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
262 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
257 | end |
|
263 | end | |
@@ -587,6 +593,7 RAW | |||||
587 | end |
|
593 | end | |
588 |
|
594 | |||
589 | def test_wiki_links |
|
595 | def test_wiki_links | |
|
596 | russian_eacape = CGI.escape(@russian_test) | |||
590 | to_test = { |
|
597 | to_test = { | |
591 | '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', |
|
598 | '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', | |
592 | '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>', |
|
599 | '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>', | |
@@ -597,7 +604,8 RAW | |||||
597 | '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>', |
|
604 | '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>', | |
598 | '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>', |
|
605 | '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>', | |
599 | # UTF8 anchor |
|
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 | # page that doesn't exist |
|
609 | # page that doesn't exist | |
602 | '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>', |
|
610 | '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>', | |
603 | '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>', |
|
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