From 8403868ac38a37e6a3451b2eb2c9952c7e66ae83 Mon Sep 17 00:00:00 2001 From: Tom Clark Date: Tue, 22 Feb 2011 00:12:32 -0500 Subject: [PATCH] Test that wikis can write to different branches in isolation --- test/test_wiki.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/test_wiki.rb b/test/test_wiki.rb index 4ac9aa4e..0227b6db 100644 --- a/test/test_wiki.rb +++ b/test/test_wiki.rb @@ -301,3 +301,34 @@ context "page_file_dir option" do FileUtils.rm_r(@path) end end + +context "Wiki page writing with different branch" do + setup do + @path = testpath("examples/test.git") + FileUtils.rm_rf(@path) + @repo = Grit::Repo.init_bare(@path) + @wiki = Gollum::Wiki.new(@path) + + # We need an initial commit to create the master branch + # before we can create new branches + cd = commit_details + @wiki.write_page("Gollum", :markdown, "# Gollum", cd) + + # Create our test branch and check it out + @repo.update_ref("test", @repo.commits.first.id) + @branch = Gollum::Wiki.new(@path, :ref => "test") + end + + test "write_page" do + cd = commit_details + + @branch.write_page("Bilbo", :markdown, "# Bilbo", commit_details) + assert @branch.page("Bilbo") + assert @wiki.page("Gollum") + + assert_equal 1, @wiki.repo.commits.size + assert_equal 1, @branch.repo.commits.size + + assert_equal nil, @wiki.page("Bilbo") + end +end \ No newline at end of file