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

fog_helpers_spec.rb « object_storage « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2ad1ac22359fe19f38de82ad2fc8d4fa9534eaa0 (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
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

require 'spec_helper'

module Dummy
  class Implementation
    include ObjectStorage::FogHelpers

    def storage_location_identifier
      :artifacts
    end
  end

  class WrongImplementation
    include ObjectStorage::FogHelpers
  end
end

RSpec.describe ObjectStorage::FogHelpers, feature_category: :shared do
  let(:implementation_class) { Dummy::Implementation }

  subject { implementation_class.new.available? }

  before do
    stub_artifacts_object_storage(enabled: true)
  end

  describe '#available?' do
    context 'when object storage is enabled' do
      it { is_expected.to eq(true) }
    end

    context 'when object storage is disabled' do
      before do
        stub_artifacts_object_storage(enabled: false)
      end

      it { is_expected.to eq(false) }
    end

    context 'when implementing class did not define storage_location_identifier' do
      let(:implementation_class) { Dummy::WrongImplementation }

      it 'raises an error' do
        expect { subject }.to raise_error(NotImplementedError)
      end
    end
  end
end