spec/aws/s3_spec.rb in heirloom-0.12.5 vs spec/aws/s3_spec.rb in heirloom-0.12.7
- old
+ new
@@ -245,9 +245,19 @@
@fog_double.should_receive(:put_object_acl).
with 'bucket', 'object', 'grants'
@s3.put_object_acl 'bucket', 'object', 'grants'
end
+ it "should return true if Excon::Errors::BadRequest raised when account is invalid" do
+ body = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>UnresolvableGrantByEmailAddress</Code><Message>The e-mail address you provided does not match any account on record.</Message><RequestId>1FF76C053626CF97</RequestId><EmailAddress>brett@weav.net1</EmailAddress><HostId>AXpUoV59+WbDr++4ffoKlSdbFAlPjpoyJd5riKJ9bTZLoobnGRaboeeFmkkI7vg6</HostId></Error>'
+ @response_stub = stub 'response', :body => body
+
+ @fog_double.should_receive(:put_object_acl).
+ with('bucket', 'object', 'grants').
+ and_raise Excon::Errors::BadRequest.new 'msg', 'req', @response_stub
+ @s3.put_object_acl('bucket', 'object','grants').should be_false
+ end
+
it "should call put bucket with location_constraint us-west-1" do
options = { 'LocationConstraint' => 'us-west-1',
'x-amz-acl' => 'private' }
@fog_double.should_receive(:put_bucket).
with('name', options)