added an option to force the deletion of a attachment

This commit is contained in:
Matt Aimonetti 2009-07-29 20:12:35 -07:00
parent beb801d1bd
commit 5270fde0fa
3 changed files with 24 additions and 4 deletions

View file

@ -372,6 +372,15 @@ describe CouchRest::Database do
@doc = @db.get('mydocwithattachment') # avoid getting a 409
lambda{ @db.fetch_attachment(@doc,'test.html')}.should raise_error
end
it "should force a delete even if we get a 409" do
@doc['new_attribute'] = 'something new'
@db.put_attachment(@doc, 'test', File.open(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'attachments', 'test.html')).read)
# at this point the revision number changed, if we try to save doc one more time
# we would get a 409.
lambda{ @db.save_doc(@doc) }.should raise_error
lambda{ @db.delete_attachment(@doc, "test", true) }.should_not raise_error
end
end
describe "POST document with attachment (with funky name)" do