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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/object_storage/fog_helpers_spec.rb')
-rw-r--r--spec/lib/object_storage/fog_helpers_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/lib/object_storage/fog_helpers_spec.rb b/spec/lib/object_storage/fog_helpers_spec.rb
new file mode 100644
index 00000000000..2ad1ac22359
--- /dev/null
+++ b/spec/lib/object_storage/fog_helpers_spec.rb
@@ -0,0 +1,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