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:
parent
c212af4afa
commit
46ed65fa45
2 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue