FIX: `S3Helper#list` creates incorrect prefix.
This commit is contained in:
parent
68572b8afc
commit
df04e69cde
|
@ -136,7 +136,11 @@ class S3Helper
|
|||
end
|
||||
|
||||
def list(prefix = "")
|
||||
s3_bucket.objects(prefix: "#{@s3_bucket_folder_path}/#{prefix}")
|
||||
if @s3_bucket_folder_path.present?
|
||||
prefix = File.join(@s3_bucket_folder_path, prefix)
|
||||
end
|
||||
|
||||
s3_bucket.objects(prefix: prefix)
|
||||
end
|
||||
|
||||
def tag_file(key, tags)
|
||||
|
|
|
@ -53,4 +53,18 @@ describe "S3Helper" do
|
|||
helper.update_tombstone_lifecycle(100)
|
||||
end
|
||||
|
||||
describe '#list' do
|
||||
it 'creates the prefix correctly' do
|
||||
{
|
||||
'some/bucket' => 'bucket/testing',
|
||||
'some' => 'testing'
|
||||
}.each do |bucket_name, prefix|
|
||||
s3_helper = S3Helper.new(bucket_name)
|
||||
bucket = stub('s3_bucket')
|
||||
s3_helper.expects(:s3_bucket).returns(bucket)
|
||||
bucket.expects(:objects).with(prefix: prefix)
|
||||
s3_helper.list('testing')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue