diff options
Diffstat (limited to 'spec/initializers/carrierwave_patch_spec.rb')
-rw-r--r-- | spec/initializers/carrierwave_patch_spec.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/initializers/carrierwave_patch_spec.rb b/spec/initializers/carrierwave_patch_spec.rb index cbdad4aa9ac..e219db2299d 100644 --- a/spec/initializers/carrierwave_patch_spec.rb +++ b/spec/initializers/carrierwave_patch_spec.rb @@ -81,19 +81,32 @@ RSpec.describe 'CarrierWave::Storage::Fog::File' do end describe '#authenticated_url' do + let(:expire_at) { 24.hours.from_now } + let(:options) { { expire_at: expire_at } } + it 'has an authenticated URL' do - expect(subject.authenticated_url).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token") + expect(subject.authenticated_url(options)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token") end context 'with custom expire_at' do it 'properly sets expires param' do - expire_at = 24.hours.from_now + expect_next_instance_of(Fog::Storage::AzureRM::File) do |file| + expect(file).to receive(:url).with(expire_at, options).and_call_original + end + + expect(subject.authenticated_url(options)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token") + end + end + + context 'with content_disposition option' do + let(:options) { { expire_at: expire_at, content_disposition: 'attachment' } } + it 'passes options' do expect_next_instance_of(Fog::Storage::AzureRM::File) do |file| - expect(file).to receive(:url).with(expire_at).and_call_original + expect(file).to receive(:url).with(expire_at, options).and_call_original end - expect(subject.authenticated_url(expire_at: expire_at)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token") + expect(subject.authenticated_url(options)).to eq("https://sa.blob.core.windows.net/test_container/test_blob?token") end end end |