2009-08-17 15:55:30 -07:00
|
|
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2009-06-07 01:37:54 -07:00
|
|
|
|
|
|
|
describe 'S3.delete_object' do
|
|
|
|
|
2009-06-08 15:49:24 -07:00
|
|
|
before(:all) do
|
2009-08-17 22:39:44 -07:00
|
|
|
s3.put_bucket('fogdeleteobject')
|
2009-08-17 15:55:30 -07:00
|
|
|
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
2009-08-17 22:39:44 -07:00
|
|
|
s3.put_object('fogdeleteobject', 'fog_delete_object', file)
|
2009-06-08 15:49:24 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
after(:all) do
|
2009-08-17 22:39:44 -07:00
|
|
|
s3.delete_bucket('fogdeleteobject')
|
2009-06-08 15:49:24 -07:00
|
|
|
end
|
|
|
|
|
2009-06-07 01:37:54 -07:00
|
|
|
it 'should return proper attributes' do
|
2009-08-17 22:39:44 -07:00
|
|
|
actual = s3.delete_object('fogdeleteobject', 'fog_delete_object')
|
2009-06-25 00:32:27 -07:00
|
|
|
actual.status.should == 204
|
2009-06-07 01:37:54 -07:00
|
|
|
end
|
|
|
|
|
2009-08-16 13:31:36 -07:00
|
|
|
it 'should raise NotFound error if the bucket does not exist' do
|
|
|
|
lambda {
|
2009-08-17 22:39:44 -07:00
|
|
|
s3.delete_object('fognotabucket', 'fog_delete_object')
|
2009-08-16 13:31:36 -07:00
|
|
|
}.should raise_error(Fog::Errors::NotFound)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not raise an error if the object does not exist' do
|
2009-08-17 22:39:44 -07:00
|
|
|
s3.delete_object('fogdeleteobject', 'fog_not_an_object')
|
2009-08-16 13:31:36 -07:00
|
|
|
end
|
|
|
|
|
2009-06-07 01:37:54 -07:00
|
|
|
end
|