diff options
Diffstat (limited to 'spec/services/packages')
-rw-r--r-- | spec/services/packages/maven/metadata/sync_service_spec.rb | 19 | ||||
-rw-r--r-- | spec/services/packages/nuget/metadata_extraction_service_spec.rb | 4 |
2 files changed, 3 insertions, 20 deletions
diff --git a/spec/services/packages/maven/metadata/sync_service_spec.rb b/spec/services/packages/maven/metadata/sync_service_spec.rb index a736ed281f0..9a704d749b3 100644 --- a/spec/services/packages/maven/metadata/sync_service_spec.rb +++ b/spec/services/packages/maven/metadata/sync_service_spec.rb @@ -9,6 +9,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do let_it_be(:user) { create(:user) } let_it_be_with_reload(:versionless_package_for_versions) { create(:maven_package, name: 'test', version: nil, project: project) } let_it_be_with_reload(:metadata_file_for_versions) { create(:package_file, :xml, package: versionless_package_for_versions) } + let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: versionless_package_for_versions, file_name: Packages::Maven::Metadata.filename) } let(:service) { described_class.new(container: project, current_user: user, params: { package_name: versionless_package_for_versions.name }) } @@ -265,22 +266,4 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do end end end - - # TODO When cleaning up packages_installable_package_files, consider adding a - # dummy package file pending for destruction on L10/11 and remove this context - context 'with package files pending destruction' do - let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: versionless_package_for_versions, file_name: Packages::Maven::Metadata.filename) } - - subject { service.send(:metadata_package_file_for, versionless_package_for_versions) } - - it { is_expected.not_to eq(package_file_pending_destruction) } - - context 'with packages_installable_package_files disabled' do - before do - stub_feature_flags(packages_installable_package_files: false) - end - - it { is_expected.to eq(package_file_pending_destruction) } - end - end end diff --git a/spec/services/packages/nuget/metadata_extraction_service_spec.rb b/spec/services/packages/nuget/metadata_extraction_service_spec.rb index 8eddd27f8a2..fc21cfd502e 100644 --- a/spec/services/packages/nuget/metadata_extraction_service_spec.rb +++ b/spec/services/packages/nuget/metadata_extraction_service_spec.rb @@ -78,7 +78,7 @@ RSpec.describe Packages::Nuget::MetadataExtractionService do end context 'with invalid package file id' do - let(:package_file) { OpenStruct.new(id: 555) } + let(:package_file) { double('file', id: 555) } it { expect { subject }.to raise_error(::Packages::Nuget::MetadataExtractionService::ExtractionError, 'invalid package file') } end @@ -109,7 +109,7 @@ RSpec.describe Packages::Nuget::MetadataExtractionService do context 'with a too big nuspec file' do before do - allow_any_instance_of(Zip::File).to receive(:glob).and_return([OpenStruct.new(size: 6.megabytes)]) + allow_any_instance_of(Zip::File).to receive(:glob).and_return([double('file', size: 6.megabytes)]) end it { expect { subject }.to raise_error(::Packages::Nuget::MetadataExtractionService::ExtractionError, 'nuspec file too big') } |