Commit 2cd68ab8 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix CI specs

parent a322a5e7
require 'fog/aws'
require 'carrierwave/storage/fog'
class ObjectStoreUploader < GitlabUploader
class ObjectStoreUploader < CarrierWave::Uploader::Base
before :store, :set_default_local_store
before :store, :verify_license!
......@@ -29,6 +29,14 @@ class ObjectStoreUploader < GitlabUploader
@field = field
end
def file_storage?
storage.is_a?(CarrierWave::Storage::File)
end
def file_cache_storage?
cache_storage.is_a?(CarrierWave::Storage::File)
end
def object_store
subject.public_send(:"#{field}_store")
end
......@@ -112,6 +120,10 @@ class ObjectStoreUploader < GitlabUploader
raise 'Object Storage feature is missing' unless subject.project.feature_available?(:object_storage)
end
def exists?
file.try(:exists?)
end
private
def set_default_local_store(new_file)
......
......@@ -22,6 +22,42 @@ describe ObjectStoreUploader do
end
end
describe '#file_storage?' do
context 'when file storage is used' do
before do
uploader_class.storage(:file)
end
it { is_expected.to be_file_storage }
end
context 'when is remote storage' do
before do
uploader_class.storage(:fog)
end
it { is_expected.not_to be_file_storage }
end
end
describe '#file_cache_storage?' do
context 'when file storage is used' do
before do
uploader_class.cache_storage(:file)
end
it { is_expected.to be_file_cache_storage }
end
context 'when is remote storage' do
before do
uploader_class.cache_storage(:fog)
end
it { is_expected.not_to be_file_cache_storage }
end
end
context 'when using ArtifactsUploader' do
let(:job) { create(:ci_build, :artifacts, artifacts_file_store: store) }
let(:uploader) { job.artifacts_file }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment