From cabd0ed85e4a1905fc715e6723ed93a0aa20d8f2 Mon Sep 17 00:00:00 2001 From: kristi Date: Fri, 11 May 2012 13:27:43 -0700 Subject: [PATCH] Add tests for new universal_toc and header_hashtags wiki options --- test/test_wiki.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/test_wiki.rb b/test/test_wiki.rb index f866f853..93e8622a 100644 --- a/test/test_wiki.rb +++ b/test/test_wiki.rb @@ -105,6 +105,35 @@ context "Wiki page previewing" do end end +context "Wiki TOC" do + setup do + @path = testpath("examples/lotr.git") + options = {:header_hashtags => false, :universal_toc => true} + @wiki = Gollum::Wiki.new(@path, options) + end + + test "toc_generation" do + page = @wiki.preview_page("Test", "# Bilbo", :markdown) + assert_equal "# Bilbo", page.raw_data + assert_equal '

Bilbo

', page.formatted_data.gsub(/\n/,"") + assert_equal '', page.toc_data.gsub(/\n */,"") + end +end + +context "Wiki header hashtags" do + setup do + @path = testpath("examples/lotr.git") + options = {:header_hashtags => true, :universal_toc => false} + @wiki = Gollum::Wiki.new(@path, options) + end + + test "header_hashtags" do + page = @wiki.preview_page("Test", "# Bilbo", :markdown) + assert_equal "# Bilbo", page.raw_data + assert_equal '

Bilbo

', page.formatted_data.gsub(/\n/,"") + end +end + context "Wiki page writing" do setup do @path = testpath("examples/test.git")