summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-06 04:45:54 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-06 04:45:54 +0000
commit3817f1e30455f4df5135af5f608f1a3912fcf4ff (patch)
tree39dd2096b421f220feabda6254ac009171a06a12
parent50eed3f9ab31b30606f5f9d33d2e107498aaf5ab (diff)
downloadredmine-3817f1e30455f4df5135af5f608f1a3912fcf4ff.tar.gz
redmine-3817f1e30455f4df5135af5f608f1a3912fcf4ff.zip
Rails4: replace hard-coded html with class at ApplicationHelperTest#test_wiki_links_within_wiki_page_context
See r12784 comment. git-svn-id: http://svn.redmine.org/redmine/trunk@12843 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/unit/helpers/application_helper_test.rb70
1 files changed, 52 insertions, 18 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 44cdf1693..d2dec16e2 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -714,30 +714,64 @@ RAW
end
def test_wiki_links_within_wiki_page_context
-
page = WikiPage.find_by_title('Another_page' )
-
to_test = {
- # link to another page
- '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>',
- '[[CookBook documentation|documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">documentation</a>',
- '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
- '[[CookBook documentation#One-section|documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">documentation</a>',
+ '[[CookBook documentation]]' =>
+ link_to("CookBook documentation",
+ "/projects/ecookbook/wiki/CookBook_documentation",
+ :class => "wiki-page"),
+ '[[CookBook documentation|documentation]]' =>
+ link_to("documentation",
+ "/projects/ecookbook/wiki/CookBook_documentation",
+ :class => "wiki-page"),
+ '[[CookBook documentation#One-section]]' =>
+ link_to("CookBook documentation",
+ "/projects/ecookbook/wiki/CookBook_documentation#One-section",
+ :class => "wiki-page"),
+ '[[CookBook documentation#One-section|documentation]]' =>
+ link_to("documentation",
+ "/projects/ecookbook/wiki/CookBook_documentation#One-section",
+ :class => "wiki-page"),
# link to the current page
- '[[Another page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Another page</a>',
- '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>',
- '[[Another page#anchor]]' => '<a href="#anchor" class="wiki-page">Another page</a>',
- '[[Another page#anchor|Page]]' => '<a href="#anchor" class="wiki-page">Page</a>',
+ '[[Another page]]' =>
+ link_to("Another page",
+ "/projects/ecookbook/wiki/Another_page",
+ :class => "wiki-page"),
+ '[[Another page|Page]]' =>
+ link_to("Page",
+ "/projects/ecookbook/wiki/Another_page",
+ :class => "wiki-page"),
+ '[[Another page#anchor]]' =>
+ link_to("Another page",
+ "#anchor",
+ :class => "wiki-page"),
+ '[[Another page#anchor|Page]]' =>
+ link_to("Page",
+ "#anchor",
+ :class => "wiki-page"),
# page that doesn't exist
- '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page?parent=Another_page" class="wiki-page new">Unknown page</a>',
- '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page?parent=Another_page" class="wiki-page new">404</a>',
- '[[Unknown page#anchor]]' => '<a href="/projects/ecookbook/wiki/Unknown_page?parent=Another_page#anchor" class="wiki-page new">Unknown page</a>',
- '[[Unknown page#anchor|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page?parent=Another_page#anchor" class="wiki-page new">404</a>',
+ '[[Unknown page]]' =>
+ link_to("Unknown page",
+ "/projects/ecookbook/wiki/Unknown_page?parent=Another_page",
+ :class => "wiki-page new"),
+ '[[Unknown page|404]]' =>
+ link_to("404",
+ "/projects/ecookbook/wiki/Unknown_page?parent=Another_page",
+ :class => "wiki-page new"),
+ '[[Unknown page#anchor]]' =>
+ link_to("Unknown page",
+ "/projects/ecookbook/wiki/Unknown_page?parent=Another_page#anchor",
+ :class => "wiki-page new"),
+ '[[Unknown page#anchor|404]]' =>
+ link_to("404",
+ "/projects/ecookbook/wiki/Unknown_page?parent=Another_page#anchor",
+ :class => "wiki-page new"),
}
-
@project = Project.find(1)
-
- to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(WikiContent.new( :text => text, :page => page ), :text) }
+ to_test.each do |text, result|
+ assert_equal "<p>#{result}</p>",
+ textilizable(WikiContent.new( :text => text, :page => page ), :text)
+ end
end
def test_wiki_links_anchor_option_should_prepend_page_title_to_href