Welcome to mirror list, hosted at ThFree Co, Russian Federation.

s3_spec.rb « object_storage « uploaders « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de86642c58dfac73c2d7446dfe3fb76b08628ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ObjectStorage::S3, feature_category: :source_code_management do
  describe '.signed_head_url' do
    subject { described_class.signed_head_url(package_file.file) }

    let(:package_file) { create(:package_file) }

    context 'when the provider is AWS' do
      before do
        stub_lfs_object_storage(config: Gitlab.config.lfs.object_store.merge(
          connection: {
            provider: 'AWS',
            aws_access_key_id: 'test',
            aws_secret_access_key: 'test'
          }
        ))
      end

      it 'generates a signed url' do
        expect_next_instance_of(Fog::AWS::Storage::Files) do |instance|
          expect(instance).to receive(:head_url).and_return(a_valid_url)
        end

        subject
      end

      it 'delegates to Fog::AWS::Storage::Files#head_url' do
        expect_next_instance_of(Fog::AWS::Storage::Files) do |instance|
          expect(instance).to receive(:head_url).and_return('stubbed_url')
        end

        expect(subject).to eq('stubbed_url')
      end
    end
  end
end