yield the created SHA1 in the after_commit callback

This commit is contained in:
rick
2011-01-19 05:51:16 -08:00
parent 2b1510af11
commit 8ddb781588
3 changed files with 30 additions and 6 deletions
+23
View File
@@ -24,4 +24,27 @@ context "Wiki" do
assert_equal 'bob', committer.actor.name
assert_equal 'foo@bar.com', committer.actor.email
end
test "yield after_commit callback" do
@path = cloned_testpath('examples/lotr.git')
yielded = nil
begin
wiki = Gollum::Wiki.new(@path)
committer = Gollum::Committer.new(wiki)
committer.after_commit do |index, sha1|
yielded = sha1
assert_equal committer, index
end
res = wiki.write_page("Gollum", :markdown, "# Gollum",
:committer => committer)
assert_equal committer, res
sha1 = committer.commit
assert_equal sha1, yielded
ensure
FileUtils.rm_rf(@path)
end
end
end