Rails4: use link_to instead of hard coded html at ApplicationHelperTest#test_wiki_links_within_local_file_generation_context

On Rails 4.0.2, test fails.

<pre>
  --- expected
  +++ actual
  @@ -1 +1 @@
  -"<p><a href=\"CookBook_documentation.html\" class=\"wiki-page\">documentation</a></p>"
  +"<p><a class=\"wiki-page\" href=\"CookBook_documentation.html\">documentation</a></p>"
</pre>

git-svn-id: http://svn.redmine.org/redmine/trunk@12784 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-04 07:50:20 +00:00
parent 31cab06f91
commit 05b2bd173e
1 changed files with 27 additions and 12 deletions

View File

@ -632,23 +632,38 @@ RAW
end
def test_wiki_links_within_local_file_generation_context
to_test = {
# link to a page
'[[CookBook documentation]]' => '<a href="CookBook_documentation.html" class="wiki-page">CookBook documentation</a>',
'[[CookBook documentation|documentation]]' => '<a href="CookBook_documentation.html" class="wiki-page">documentation</a>',
'[[CookBook documentation#One-section]]' => '<a href="CookBook_documentation.html#One-section" class="wiki-page">CookBook documentation</a>',
'[[CookBook documentation#One-section|documentation]]' => '<a href="CookBook_documentation.html#One-section" class="wiki-page">documentation</a>',
'[[CookBook documentation]]' =>
link_to("CookBook documentation", "CookBook_documentation.html",
:class => "wiki-page"),
'[[CookBook documentation|documentation]]' =>
link_to("documentation", "CookBook_documentation.html",
:class => "wiki-page"),
'[[CookBook documentation#One-section]]' =>
link_to("CookBook documentation", "CookBook_documentation.html#One-section",
:class => "wiki-page"),
'[[CookBook documentation#One-section|documentation]]' =>
link_to("documentation", "CookBook_documentation.html#One-section",
:class => "wiki-page"),
# page that doesn't exist
'[[Unknown page]]' => '<a href="Unknown_page.html" class="wiki-page new">Unknown page</a>',
'[[Unknown page|404]]' => '<a href="Unknown_page.html" class="wiki-page new">404</a>',
'[[Unknown page#anchor]]' => '<a href="Unknown_page.html#anchor" class="wiki-page new">Unknown page</a>',
'[[Unknown page#anchor|404]]' => '<a href="Unknown_page.html#anchor" class="wiki-page new">404</a>',
'[[Unknown page]]' =>
link_to("Unknown page", "Unknown_page.html",
:class => "wiki-page new"),
'[[Unknown page|404]]' =>
link_to("404", "Unknown_page.html",
:class => "wiki-page new"),
'[[Unknown page#anchor]]' =>
link_to("Unknown page", "Unknown_page.html#anchor",
:class => "wiki-page new"),
'[[Unknown page#anchor|404]]' =>
link_to("404", "Unknown_page.html#anchor",
:class => "wiki-page new"),
}
@project = Project.find(1)
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :local) }
to_test.each do |text, result|
assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :local)
end
end
def test_wiki_links_within_wiki_page_context