Fix Broken Tests
In preparation for adding new tests, let's fix the existing ones. 3 Unit tests and one Functional test still fail. * Two unit tests are bugs in xhtmldiff * One is a bug in Maruku * A file upload functional test fails, for reasons that escape me.
This commit is contained in:
parent
119ab342dc
commit
d0e834978a
4
test/fixtures/webs.yml
vendored
4
test/fixtures/webs.yml
vendored
|
@ -4,7 +4,7 @@ test_wiki:
|
||||||
updated_at: 2005-08-01
|
updated_at: 2005-08-01
|
||||||
name: wiki1
|
name: wiki1
|
||||||
address: wiki1
|
address: wiki1
|
||||||
markup: textile
|
markup: markdownMML
|
||||||
|
|
||||||
instiki:
|
instiki:
|
||||||
id: 2
|
id: 2
|
||||||
|
@ -12,4 +12,4 @@ instiki:
|
||||||
updated_at: 2005-08-01
|
updated_at: 2005-08-01
|
||||||
name: Instiki
|
name: Instiki
|
||||||
address: instiki
|
address: instiki
|
||||||
markup: textile
|
markup: markdownMML
|
||||||
|
|
|
@ -151,7 +151,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
assert_response(:success, bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/zip', r.headers['Content-Type']
|
assert_equal 'application/zip', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-textile-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
assert_match /attachment; filename="wiki1-markdownMML-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
|
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
|
||||||
end
|
end
|
||||||
|
@ -665,14 +665,45 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
assert_response(:success)
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal "\\documentclass[12pt,titlepage]{article}\n\n\\usepackage{amsmath}" +
|
assert_equal %q!\documentclass[12pt,titlepage]{article}
|
||||||
"\n\\usepackage{amsfonts}\n\\usepackage{graphicx}\n\\usepackage{ucs}\n" +
|
|
||||||
"\\usepackage[utf8x]{inputenc}\n\\usepackage{hyperref}\n\n" +
|
\usepackage{amsmath}
|
||||||
"%-------------------------------------------------------------------\n\n" +
|
\usepackage{amsfonts}
|
||||||
"\\begin{document}\n\n%--------------------------------------------------" +
|
\usepackage{amssymb}
|
||||||
"-----------------\n\n\\section*{HomePage}\n\nTeX export only supported with" +
|
\usepackage{graphicx}
|
||||||
" the Markdown text filters.\n\n\\end{document}\n",
|
\usepackage{ucs}
|
||||||
r.body
|
\usepackage[utf8x]{inputenc}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
|
||||||
|
%----Macros----------
|
||||||
|
\newcommand{\gt}{>}
|
||||||
|
\newcommand{\lt}{<}
|
||||||
|
\newcommand{\darr}{\downarrow}
|
||||||
|
\newcommand{\nearr}{\nearrow}
|
||||||
|
\newcommand{\nwarr}{\nwarrow}
|
||||||
|
\newcommand{\searr}{\searrow}
|
||||||
|
\newcommand{\swarr}{\swarrow}
|
||||||
|
\newcommand{\iff}{\Longleftrightarrow}
|
||||||
|
\newcommand{\impliedby}{\Leftarrow}
|
||||||
|
\newcommand{\map}{\mapsto}
|
||||||
|
\newcommand{\embedsin}{\hookrightarrow}
|
||||||
|
\newcommand{\implies}{\Rightarrow}
|
||||||
|
\newcommand{\qed}{\blacksquare}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------------
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------------
|
||||||
|
|
||||||
|
\section*{HomePage}
|
||||||
|
|
||||||
|
HisWay would be MyWay in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
||||||
|
!, r.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
'would be <a class="existingWikiWord" href="../show/MyWay">My Way</a> in kinda ' +
|
'would be <a class="existingWikiWord" href="../show/MyWay">My Way</a> in kinda ' +
|
||||||
'<a class="existingWikiWord" href="../show/ThatWay">That Way</a> in ' +
|
'<a class="existingWikiWord" href="../show/ThatWay">That Way</a> in ' +
|
||||||
'<span class="newWikiWord">His Way<a href="../show/HisWay">?</a></span> ' +
|
'<span class="newWikiWord">His Way<a href="../show/HisWay">?</a></span> ' +
|
||||||
%{though <a class="existingWikiWord" href="../show/MyWay">My Way</a> OverThere—see } +
|
%{though <a class="existingWikiWord" href="../show/MyWay">My Way</a> OverThere \xE2\x80\x93 see } +
|
||||||
'<a class="existingWikiWord" href="../show/SmartEngine">Smart Engine</a> in that ' +
|
'<a class="existingWikiWord" href="../show/SmartEngine">Smart Engine</a> in that ' +
|
||||||
'<span class="newWikiWord">Smart Engine GUI' +
|
'<span class="newWikiWord">Smart Engine GUI' +
|
||||||
'<a href="../show/SmartEngineGUI">?</a></span></p>',
|
'<a href="../show/SmartEngineGUI">?</a></span></p>',
|
||||||
|
@ -157,21 +157,21 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p><em>should we go <a class="existingWikiWord" href="../show/ThatWay">' +
|
'<p><em>should we go <a class="existingWikiWord" href="../show/ThatWay">' +
|
||||||
'That Way</a> or <span class="newWikiWord">This Way<a href="../show/ThisWay">?</a>' +
|
'That Way</a> or <span class="newWikiWord">This Way<a href="../show/ThisWay">?</a>' +
|
||||||
'</span> </em></p>',
|
'</span></em></p>',
|
||||||
'_should we go ThatWay or ThisWay _')
|
'_should we go ThatWay or ThisWay _')
|
||||||
end
|
end
|
||||||
|
|
||||||
# wikiwords are invalid as styles, must be in "name: value" form
|
# wikiwords are invalid as styles, must be in "name: value" form
|
||||||
def test_content_with_wikiword_in_style_tag
|
def test_content_with_wikiword_in_style_tag
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<p>That is some <em style=''>Stylish Emphasis</em></p>",
|
"<p>That is some <em style=\"\">Stylish Emphasis</em></p>",
|
||||||
'That is some <em style="WikiWord">Stylish Emphasis</em>')
|
'That is some <em style="WikiWord">Stylish Emphasis</em>')
|
||||||
end
|
end
|
||||||
|
|
||||||
# validates format of style..
|
# validates format of style..
|
||||||
def test_content_with_valid_style_in_style_tag
|
def test_content_with_valid_style_in_style_tag
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<p>That is some <em style='text-align: right;'>Stylish Emphasis</em></p>",
|
"<p>That is some <em style=\"text-align: right;\">Stylish Emphasis</em></p>",
|
||||||
'That is some <em style="text-align: right">Stylish Emphasis</em>')
|
'That is some <em style="text-align: right">Stylish Emphasis</em>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -182,38 +182,38 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_content_with_pre_blocks
|
def test_content_with_pre_blocks
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p>A <code>class SmartEngine end</code> would not mark up </p><pre>CodeBlocks</pre>',
|
'<p>A <code>class SmartEngine end</code> would not mark up </p>\n\n<pre>CodeBlocks</pre>\n\n<p>would it?</p>',
|
||||||
'A <code>class SmartEngine end</code> would not mark up <pre>CodeBlocks</pre>')
|
'A <code>class SmartEngine end</code> would not mark up\n\n<pre>CodeBlocks</pre>\n\nwould it?')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_content_with_autolink_in_parentheses
|
def test_content_with_autolink_in_parentheses
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p>The <span class=\'caps\'>W3C</span> body (<a href="http://www.w3c.org">' +
|
'<p>The W3C body (<a href="http://www.w3c.org">' +
|
||||||
'http://www.w3c.org</a>) sets web standards</p>',
|
'http://www.w3c.org</a>) sets web standards</p>',
|
||||||
'The W3C body (http://www.w3c.org) sets web standards')
|
'The W3C body (http://www.w3c.org) sets web standards')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_content_with_link_in_parentheses
|
def test_content_with_link_in_parentheses
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<p>(<a href='http://wiki.org/wiki.cgi?WhatIsWiki'>What is a wiki?</a>)</p>",
|
"<p>(<a href=\"http://wiki.org/wiki.cgi?WhatIsWiki\">What is a wiki?</a>)</p>",
|
||||||
'("What is a wiki?":http://wiki.org/wiki.cgi?WhatIsWiki)')
|
'([What is a wiki?](http://wiki.org/wiki.cgi?WhatIsWiki))')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_content_with_image_link
|
def test_content_with_image_link
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<p>This <img src='http://hobix.com/sample.jpg' alt=''/> is a Textile image link.</p>",
|
"<p>This <img alt=\"\" src=\"http://hobix.com/sample.jpg\" /> is a Markdown image link.</p>",
|
||||||
'This !http://hobix.com/sample.jpg! is a Textile image link.')
|
'This ![](http://hobix.com/sample.jpg) is a Markdown image link.')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_content_with_inlined_img_tag
|
def test_content_with_inlined_img_tag
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<p>This <img src='http://hobix.com/sample.jpg' alt=''/> is an inline image link.</p>",
|
"<p>This <img alt=\"\" src=\"http://hobix.com/sample.jpg\" /> is an inline image link.</p>",
|
||||||
'This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
|
'This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
|
||||||
|
|
||||||
# currently, upper case HTML elements are not allowed
|
# currently, upper case HTML elements are not allowed
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p>This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.</p>',
|
'<p>This <IMG SRC="http://hobix.com/sample.jpg" alt=""></IMG> is an inline image link.</p>',
|
||||||
'This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.')
|
'This <IMG SRC="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_nowiki_tag
|
def test_nowiki_tag
|
||||||
|
@ -244,7 +244,7 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
'<a class="existingWikiWord" href="MyWay.html">My Way</a> in kinda ' +
|
'<a class="existingWikiWord" href="MyWay.html">My Way</a> in kinda ' +
|
||||||
'<a class="existingWikiWord" href="ThatWay.html">That Way</a> in ' +
|
'<a class="existingWikiWord" href="ThatWay.html">That Way</a> in ' +
|
||||||
'<span class="newWikiWord">His Way</span> though ' +
|
'<span class="newWikiWord">His Way</span> though ' +
|
||||||
%{<a class="existingWikiWord" href="MyWay.html">My Way</a> OverThere—see } +
|
%{<a class="existingWikiWord" href="MyWay.html">My Way</a> OverThere \xE2\x80\x93 see } +
|
||||||
'<a class="existingWikiWord" href="SmartEngine.html">Smart Engine</a> in that ' +
|
'<a class="existingWikiWord" href="SmartEngine.html">Smart Engine</a> in that ' +
|
||||||
'<span class="newWikiWord">Smart Engine GUI</span></p>',
|
'<span class="newWikiWord">Smart Engine GUI</span></p>',
|
||||||
test_renderer(@revision).display_content_for_export
|
test_renderer(@revision).display_content_for_export
|
||||||
|
@ -253,14 +253,14 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
def test_double_replacing
|
def test_double_replacing
|
||||||
@revision.content = "VersionHistory\r\n\r\ncry VersionHistory"
|
@revision.content = "VersionHistory\r\n\r\ncry VersionHistory"
|
||||||
assert_equal '<p><span class="newWikiWord">Version History' +
|
assert_equal '<p><span class="newWikiWord">Version History' +
|
||||||
"<a href=\"../show/VersionHistory\">?</a></span></p>\n\n\n\t<p>cry " +
|
"<a href=\"../show/VersionHistory\">?</a></span></p>\n\n<p>cry " +
|
||||||
'<span class="newWikiWord">Version History<a href="../show/VersionHistory">?</a>' +
|
'<span class="newWikiWord">Version History<a href="../show/VersionHistory">?</a>' +
|
||||||
'</span></p>',
|
'</span></p>',
|
||||||
test_renderer(@revision).display_content
|
test_renderer(@revision).display_content
|
||||||
|
|
||||||
@revision.content = "f\r\nVersionHistory\r\n\r\ncry VersionHistory"
|
@revision.content = "f\r\nVersionHistory\r\n\r\ncry VersionHistory"
|
||||||
assert_equal "<p>f<br/><span class=\"newWikiWord\">Version History" +
|
assert_equal "<p>f <span class=\"newWikiWord\">Version History" +
|
||||||
"<a href=\"../show/VersionHistory\">?</a></span></p>\n\n\n\t<p>cry " +
|
"<a href=\"../show/VersionHistory\">?</a></span></p>\n\n<p>cry " +
|
||||||
"<span class=\"newWikiWord\">Version History<a href=\"../show/VersionHistory\">?</a>" +
|
"<span class=\"newWikiWord\">Version History<a href=\"../show/VersionHistory\">?</a>" +
|
||||||
"</span></p>",
|
"</span></p>",
|
||||||
test_renderer(@revision).display_content
|
test_renderer(@revision).display_content
|
||||||
|
@ -321,12 +321,12 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_list_with_tildas
|
def test_list_with_tildas
|
||||||
list_with_tildas = <<-EOL
|
list_with_tildas = <<-EOL
|
||||||
* "a":~b
|
* [a](~b)
|
||||||
* c~ d
|
* c~ d
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
"<ul>\n\t<li><a href='~b'>a</a></li>\n\t\t<li>c~ d</li>\n\t</ul>",
|
"<ul>\n<li><a href=\"~b\">a</a></li>\n\n<li>c~ d</li>\n</ul>",
|
||||||
list_with_tildas)
|
list_with_tildas)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
#require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||||
|
|
||||||
class WebTest < Test::Unit::TestCase
|
class WebTest < Test::Unit::TestCase
|
||||||
fixtures :webs, :pages, :revisions, :system, :wiki_references
|
fixtures :system, :webs, :pages, :revisions, :wiki_references
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@web = webs(:instiki)
|
@web = webs(:instiki)
|
||||||
|
|
Loading…
Reference in a new issue