diff options
Diffstat (limited to 'spec/uploaders/packages')
-rw-r--r-- | spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb | 4 | ||||
-rw-r--r-- | spec/uploaders/packages/package_file_uploader_spec.rb | 71 |
2 files changed, 34 insertions, 41 deletions
diff --git a/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb index 203a453bcdd..dbbf69e3c8d 100644 --- a/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb +++ b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb @@ -49,12 +49,12 @@ RSpec.describe Packages::Debian::DistributionReleaseFileUploader do end describe '#filename' do - it { expect(subject.filename).to eq('Release')} + it { expect(subject.filename).to eq('Release') } context 'with signed_file' do let(:uploader) { described_class.new(distribution, :signed_file) } - it { expect(subject.filename).to eq('InRelease')} + it { expect(subject.filename).to eq('InRelease') } end end end diff --git a/spec/uploaders/packages/package_file_uploader_spec.rb b/spec/uploaders/packages/package_file_uploader_spec.rb index e8f4cae7b04..0c7bf6432cb 100644 --- a/spec/uploaders/packages/package_file_uploader_spec.rb +++ b/spec/uploaders/packages/package_file_uploader_spec.rb @@ -2,50 +2,43 @@ require 'spec_helper' RSpec.describe Packages::PackageFileUploader do - { - package_file: %r[^\h{2}/\h{2}/\h{64}/packages/\d+/files/\d+$], - debian_package_file: %r[^\h{2}/\h{2}/\h{64}/packages/debian/files/\d+$] - }.each do |factory, store_dir_regex| - context factory.to_s do - let(:package_file) { create(factory) } # rubocop:disable Rails/SaveBang - let(:uploader) { described_class.new(package_file, :file) } - let(:path) { Gitlab.config.packages.storage_path } - - subject { uploader } - - it_behaves_like "builds correct paths", - store_dir: store_dir_regex, - cache_dir: %r[/packages/tmp/cache], - work_dir: %r[/packages/tmp/work] - - context 'object store is remote' do - before do - stub_package_file_object_storage - end - - include_context 'with storage', described_class::Store::REMOTE - - it_behaves_like "builds correct paths", - store_dir: store_dir_regex - end + let(:package_file) { create(:package_file) } + let(:uploader) { described_class.new(package_file, :file) } + let(:path) { Gitlab.config.packages.storage_path } + + subject { uploader } + + it_behaves_like "builds correct paths", + store_dir: %r[^\h{2}/\h{2}/\h{64}/packages/\d+/files/\d+$], + cache_dir: %r[/packages/tmp/cache], + work_dir: %r[/packages/tmp/work] + + context 'object store is remote' do + before do + stub_package_file_object_storage + end - describe 'remote file' do - let(:package_file) { create(factory, :object_storage) } + include_context 'with storage', described_class::Store::REMOTE - context 'with object storage enabled' do - before do - stub_package_file_object_storage - end + it_behaves_like "builds correct paths", + store_dir: %r[^\h{2}/\h{2}/\h{64}/packages/\d+/files/\d+$] + end + + describe 'remote file' do + let(:package_file) { create(:package_file, :object_storage) } + + context 'with object storage enabled' do + before do + stub_package_file_object_storage + end - it 'can store file remotely' do - allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async) + it 'can store file remotely' do + allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async) - package_file + package_file - expect(package_file.file_store).to eq(described_class::Store::REMOTE) - expect(package_file.file.path).not_to be_blank - end - end + expect(package_file.file_store).to eq(described_class::Store::REMOTE) + expect(package_file.file.path).not_to be_blank end end end |