Test page_name, not text

Fix from Jason Blevins.
master
Jacques Distler 2009-06-12 19:47:56 -05:00
parent c98d44606a
commit 9b857d3501
3 changed files with 3 additions and 3 deletions

View File

@ -87,7 +87,7 @@ class UrlGenerator < AbstractUrlGenerator
end
def page_link(mode, name, text, web_address, known_page)
return %{<span class='wikilink-error'><b>Illegal link (contains a '.'):</b> [[#{text}]]</span>} if text.include?('.')
return %{<span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> #{name}</span>} if name.include?('.')
case mode
when :export
if known_page

View File

@ -127,7 +127,7 @@ class StubUrlGenerator < AbstractUrlGenerator
def page_link(mode, name, text, web_address, known_page)
link = CGI.escape(name)
return %{<span class='wikilink-error'><b>Illegal link (contains a '.'):</b> [[#{text}]]</span>} if text.include?('.')
return %{<span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> #{name}</span>} if name.include?('.')
case mode
when :export
if known_page then %{<a class="existingWikiWord" href="#{link}.html">#{text}</a>}

View File

@ -161,7 +161,7 @@ class PageTest < ActiveSupport::TestCase
references = new_page.wiki_references(true)
assert_equal( "<p>Reference to <a class='existingWikiWord' href='\.\./show/MyPage'>Happy Page</a>" +
" and to <span class='newWikiWord'>Wanted Page2<a href='../show/WantedPage2'>?</a></span>.pdf " +
"and <span class='wikilink-error'><b>Illegal link (contains a &#39;.&#39;):</b> [[foo.pdf]]</span></p>",
"and <span class='wikilink-error'><b>Illegal link (target contains a &#39;.&#39;):</b> foo.pdf</span></p>",
test_renderer(new_page.revisions.last).display_content(true) )
assert_equal 3, references.size
# now it works.