1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

objects.all should return nil if bucket does not exist

This commit is contained in:
Wesley Beary 2009-12-14 10:28:43 -08:00
parent c212af4afa
commit 46ed65fa45
2 changed files with 7 additions and 2 deletions

View file

@ -13,10 +13,11 @@ module Fog
model Fog::AWS::S3::Object
def all(options = {})
bucket.collection.get(
collection = bucket.collection.get(
bucket.name,
options.reject {|key, value| !['delimiter', 'marker', 'max-keys', 'prefix'].include?(key)}
).objects
)
collection && collection.objects
end
def bucket

View file

@ -33,6 +33,10 @@ describe 'Fog::AWS::S3::Objects' do
@bucket.objects.all.should be_a(Fog::AWS::S3::Objects)
end
it "should return nil if the bucket does not exist" do
bucket = s3.buckets.new(:name => 'notabucket')
bucket.objects.all.should be_nil
end
end
describe "#bucket" do