Permalink
Browse files

Test that wikis can write to different branches in isolation

  • Loading branch information...
Tom Clark
Tom Clark committed Feb 22, 2011
1 parent a1d760d commit 8403868ac38a37e6a3451b2eb2c9952c7e66ae83
Showing with 31 additions and 0 deletions.
  1. +31 −0 test/test_wiki.rb
View
@@ -301,3 +301,34 @@
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

0 comments on commit 8403868

Please sign in to comment.