This commit is contained in:
rick
2011-03-31 15:11:24 -07:00
6 changed files with 76 additions and 15 deletions
+13
View File
@@ -48,4 +48,17 @@ context "Wiki" do
FileUtils.rm_rf(@path)
end
end
test "parents with default master ref" do
ref = 'a8ad3c09dd842a3517085bfadd37718856dee813'
committer = Gollum::Committer.new(@wiki)
assert_equal ref, committer.parents.first.sha
end
test "parents with custom ref" do
ref = '60f12f4254f58801b9ee7db7bca5fa8aeefaa56b'
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"), :ref => ref)
committer = Gollum::Committer.new(@wiki)
assert_equal ref, committer.parents.first.sha
end
end
+35
View File
@@ -301,3 +301,38 @@ 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
teardown do
FileUtils.rm_rf(@path)
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