|
15 | 15 | let(:checksum) { Digest::MD5.base64digest(fixture_data) } |
16 | 16 | let(:key) { SecureRandom.base58(24) } |
17 | 17 | let(:service) { described_class.configure(:tmp, tmp: { service: 'DB' }) } |
18 | | - let(:upload_options) { {} } |
19 | | - let(:upload) { service.upload(key, StringIO.new(fixture_data), upload_options) } |
| 18 | + let(:upload) { service.upload(key, StringIO.new(fixture_data)) } |
20 | 19 |
|
21 | 20 | before do |
22 | 21 | allow(ENV).to receive(:fetch).and_call_original |
|
119 | 118 | end |
120 | 119 |
|
121 | 120 | context 'with the checksum' do |
122 | | - let(:upload_options) { { checksum: checksum } } |
| 121 | + let(:upload) { service.upload(key, StringIO.new(fixture_data), checksum: checksum) } |
123 | 122 |
|
124 | 123 | it 'uploads the data' do |
125 | 124 | expect(upload).to be_kind_of ActiveStorageDB::File |
|
129 | 128 | end |
130 | 129 |
|
131 | 130 | context 'with an invalid checksum' do |
132 | | - let(:upload_options) { { checksum: Digest::MD5.base64digest('some other data') } } |
| 131 | + let(:checksum) { Digest::MD5.base64digest('some other data') } |
| 132 | + let(:upload) { service.upload(key, StringIO.new(fixture_data), checksum: checksum) } |
133 | 133 |
|
134 | 134 | it 'fails to upload the data' do |
135 | 135 | expect { upload }.to raise_exception ActiveStorage::IntegrityError |
|
159 | 159 | end |
160 | 160 |
|
161 | 161 | describe '.url_for_direct_upload' do |
162 | | - subject { service.url_for_direct_upload(key, url_options) } |
163 | | - |
164 | | - let(:url_options) do |
165 | | - { expires_in: 5.minutes, content_type: content_type, content_length: fixture_data.size, checksum: checksum } |
| 162 | + subject do |
| 163 | + service.url_for_direct_upload( |
| 164 | + key, |
| 165 | + expires_in: 5.minutes, |
| 166 | + content_type: content_type, |
| 167 | + content_length: fixture_data.size, |
| 168 | + checksum: checksum |
| 169 | + ) |
166 | 170 | end |
167 | 171 |
|
168 | 172 | before do |
|
0 commit comments