Permalink
Browse files

ensure gitrepo delete works and returns deleted blob contents

(wish I'd written this test this morning, would have saved some debugging...)
  • Loading branch information...
1 parent b471072 commit 18ee625fa8c35ecda3a98a4f8ef0b83fadc67f1d @bronson bronson committed Nov 2, 2011
Showing with 11 additions and 1 deletion.
  1. +0 −1 lib/gitrepo.rb
  2. +11 −0 spec/gitrepo_spec.rb
View
1 lib/gitrepo.rb
@@ -126,7 +126,6 @@ def empty_index
entries.each { |name| remove name }
end
- # to test: returns the value of the deleted object
def remove name
@repo.root.delete(name).dump
end
View
11 spec/gitrepo_spec.rb
@@ -238,4 +238,15 @@ def git_tree repo, spec
repo.git('ls-tree', 'HEAD').should match /^[^\n]+README$/
end
end
+
+ it "should return the original object when deleting" do
+ with_git_commit(:bare => true) do |repo|
+ author = { :name => "delete author", :email => "del@example.com" }
+ repo.commit("delete commit", author) do |commit|
+ del = commit.remove "README"
+ del.should == "This is a test readme file\n"
+ end
+ repo.git('ls-tree', 'HEAD').should == ""
+ end
+ end
end

0 comments on commit 18ee625

Please sign in to comment.