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
|
model Fog::AWS::S3::Object
|
||||||
|
|
||||||
def all(options = {})
|
def all(options = {})
|
||||||
bucket.collection.get(
|
collection = bucket.collection.get(
|
||||||
bucket.name,
|
bucket.name,
|
||||||
options.reject {|key, value| !['delimiter', 'marker', 'max-keys', 'prefix'].include?(key)}
|
options.reject {|key, value| !['delimiter', 'marker', 'max-keys', 'prefix'].include?(key)}
|
||||||
).objects
|
)
|
||||||
|
collection && collection.objects
|
||||||
end
|
end
|
||||||
|
|
||||||
def bucket
|
def bucket
|
||||||
|
|
|
@ -33,6 +33,10 @@ describe 'Fog::AWS::S3::Objects' do
|
||||||
@bucket.objects.all.should be_a(Fog::AWS::S3::Objects)
|
@bucket.objects.all.should be_a(Fog::AWS::S3::Objects)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "#bucket" do
|
describe "#bucket" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue