diff --git a/test/test_gitcode.rb b/test/test_gitcode.rb index d0599d6d..72374ec8 100644 --- a/test/test_gitcode.rb +++ b/test/test_gitcode.rb @@ -25,17 +25,7 @@ context "gitcode" do end test 'that the rendered output is correctly fetched and rendered as html code' do - assert_equal %Q{
a
- -<ol class="tree">
- <li class="file"><a href="0">0</a></li>
-</ol>
-
-b
}, @rendered + assert_equal %Q{a
\n\n class=\"tree\">\n - class=\"file\"> href=\"0\">0
\n
\nb
}, @rendered end test 'contents' do diff --git a/test/test_markup.rb b/test/test_markup.rb index 5ac12435..fc34263d 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -1,14 +1,17 @@ # ~*~ encoding: utf-8 ~*~ -require File.expand_path( "../helper", __FILE__ ) -require File.expand_path( "../wiki_factory", __FILE__ ) +require File.expand_path(File.join(File.dirname(__FILE__), "helper")) context "Markup" do setup do - @wiki, @path, @teardown = WikiFactory.create 'examples/test.git' + @path = testpath("examples/test.git") + FileUtils.rm_rf(@path) + Grit::Repo.init_bare(@path) + Gollum::Wiki.default_options = {:universal_toc => false} + @wiki = Gollum::Wiki.new(@path) end teardown do - @teardown.call + FileUtils.rm_r(File.join(File.dirname(__FILE__), *%w[examples test.git])) end test "formats page from Wiki#pages" do @@ -181,6 +184,22 @@ context "Markup" do assert_equal "sed -i '' 's/[[:space:]]*$//'
rot13='tr '\\''A-Za-z'\\'' '\\''N-ZA-Mn-za-m'\\'\n
\n}.strip # remove trailing \n
+ assert_equal expected, output
+ end
+
test "wiki link within code block" do
@wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details)
page = @wiki.page("Potato")
@@ -393,9 +412,7 @@ context "Markup" do
test "code blocks" do
content = "a\n\n```ruby\nx = 1\n```\n\nb"
- output = "a
\n\n" +
- "x = " +
- "1\n\nb
" + output = %Q{a
\n\nx = 1\nb
} index = @wiki.repo.index index.add("Bilbo-Baggins.md", content) @@ -408,9 +425,7 @@ context "Markup" do test "code blocks with carriage returns" do content = "a\r\n\r\n```ruby\r\nx = 1\r\n```\r\n\r\nb" - output = "a
\n\n" +
- "x = " +
- "1\n\nb
" + output = %Q{a
\n\nx = 1\nb
} index = @wiki.repo.index index.add("Bilbo-Baggins.md", content) @@ -441,9 +456,7 @@ context "Markup" do test "code blocks with multibyte caracters indent" do content = "a\n\n```ruby\ns = 'やくしまるえつこ'\n```\n\nb" - output = "a
\n\n" +
- "s = 'やくしまるえつこ'" +
- "\n\nb
" + output = %Q{a
\n\ns = 'やくしまるえつこ'\nb
} index = @wiki.repo.index index.add("Bilbo-Baggins.md", content) index.commit("Add alpha.jpg") @@ -503,7 +516,7 @@ np.array([[2,2],[1,3]],np.float) output_page = @wiki.page("page").formatted_data assert_equal %Q{a b
}, output_script - assert_equal %Q{<p>a b</p>\n\n<p>a b</p>\na\n
<p>a\n!base</p>\n\na\n
<p>a\n!base</p>\na\n
<p>a\n!rel</p>\n\na\n
<p>a\n!rel</p>\n