summaryrefslogtreecommitdiff
path: root/spec/finders/packages/conan/package_file_finder_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/finders/packages/conan/package_file_finder_spec.rb')
-rw-r--r--spec/finders/packages/conan/package_file_finder_spec.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/finders/packages/conan/package_file_finder_spec.rb b/spec/finders/packages/conan/package_file_finder_spec.rb
index c2f445c58f7..3da7da456c2 100644
--- a/spec/finders/packages/conan/package_file_finder_spec.rb
+++ b/spec/finders/packages/conan/package_file_finder_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe ::Packages::Conan::PackageFileFinder do
let(:package_file_name) { package_file.file_name }
let(:params) { {} }
- RSpec.shared_examples 'package file finder examples' do
+ shared_examples 'package file finder examples' do
it { is_expected.to eq(package_file) }
context 'with conan_file_type' do
@@ -39,11 +39,37 @@ RSpec.describe ::Packages::Conan::PackageFileFinder do
end
end
+ shared_examples 'not returning pending_destruction package files' do
+ let_it_be(:recent_package_file_pending_destruction) do
+ create(:package_file, :pending_destruction, package: package, file_name: package_file.file_name)
+ end
+
+ it 'returns the correct package file' do
+ expect(package.package_files.last).to eq(recent_package_file_pending_destruction)
+
+ expect(subject).to eq(package_file)
+ end
+
+ context 'with packages_installable_package_files disabled' do
+ before do
+ stub_feature_flags(packages_installable_package_files: false)
+ end
+
+ it 'returns the correct package file' do
+ expect(package.package_files.last).to eq(recent_package_file_pending_destruction)
+
+ expect(subject).to eq(recent_package_file_pending_destruction)
+ end
+ end
+ end
+
describe '#execute' do
subject { described_class.new(package, package_file_name, params).execute }
it_behaves_like 'package file finder examples'
+ it_behaves_like 'not returning pending_destruction package files'
+
context 'with unknown file_name' do
let(:package_file_name) { 'unknown.jpg' }
@@ -56,6 +82,8 @@ RSpec.describe ::Packages::Conan::PackageFileFinder do
it_behaves_like 'package file finder examples'
+ it_behaves_like 'not returning pending_destruction package files'
+
context 'with unknown file_name' do
let(:package_file_name) { 'unknown.jpg' }