Skip to content

Commit bd08d85

Browse files
Merge pull request #6 from wallarm/fix-s3-download
2 parents f930ed9 + 9e0691a commit bd08d85

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

lib/cloud_storage/objects/s3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def delete!
3838
private
3939

4040
def internal_download(local_file)
41-
@resource.bucket(bucket_name).object(key).download_file(local_file)
41+
@client.get_object(response_target: local_file, bucket: bucket_name, key: key)
4242

4343
local_file
4444
end

lib/cloud_storage/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module CloudStorage
4-
VERSION = '0.1.1'
4+
VERSION = '0.1.2'
55
end

spec/cloud_storage/objects/s3_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@
6262

6363
expect(content).to eq("This is a test upload\n")
6464
end
65+
66+
context 'when 6mb file' do
67+
let(:file) { File.open('spec/fixtures/6mb.bin', 'rb') }
68+
69+
it do
70+
expect { content }.not_to(change { opened_tmp_files_count })
71+
72+
expect(content.size).to eq(6_000_000)
73+
end
74+
end
6575
end
6676

6777
context 'when download to a custom tmp' do
@@ -83,6 +93,20 @@
8393
.to("This is a test upload\n")
8494
.and change { opened_tmp_files_count }.by(0)
8595
end
96+
97+
context 'when 6mb file' do
98+
let(:file) { File.open('spec/fixtures/6mb.bin', 'rb') }
99+
100+
it do
101+
tmp
102+
103+
expect { content }
104+
.to change(tmp, :size)
105+
.from(0)
106+
.to(6_000_000)
107+
.and change { opened_tmp_files_count }.by(0)
108+
end
109+
end
86110
end
87111
end
88112
end

spec/fixtures/6mb.bin

5.72 MB
Binary file not shown.

0 commit comments

Comments
 (0)