Add bulk save deferal option to db.delete / doc.destroy, just like on save.

This commit is contained in:
Antony Blakey 2009-01-09 20:29:08 +10:30
parent 245f525902
commit 36945d5a13
4 changed files with 41 additions and 3 deletions

View file

@ -109,3 +109,22 @@ describe "destroying a document from a db" do
lambda{@doc.destroy}.should raise_error(ArgumentError)
end
end
describe "destroying a document from a db using bulk save" do
before(:all) do
@db = reset_test_db!
@resp = @db.save({
"key" => "value"
})
@doc = @db.get @resp['id']
end
it "should defer actual deletion" do
@doc.destroy(true)
@doc['_id'].should == nil
@doc['_rev'].should == nil
lambda{@db.get @resp['id']}.should_not raise_error
@db.bulk_save
lambda{@db.get @resp['id']}.should raise_error
end
end