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
|