diff options
Diffstat (limited to 'spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb index 750d3dd11e3..3f8c3b8960b 100644 --- a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb +++ b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb @@ -198,7 +198,6 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze| describe 'relationships' do it { is_expected.to have_many(:publications).class_name('Packages::Debian::Publication').inverse_of(:distribution).with_foreign_key(:distribution_id) } it { is_expected.to have_many(:packages).class_name('Packages::Package').through(:publications) } - it { is_expected.to have_many(:package_files).class_name('Packages::PackageFile').through(:packages) } end end else @@ -229,6 +228,26 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze| it 'returns only files from public packages with same codename' do expect(subject.to_a).to contain_exactly(*public_package_with_same_codename.package_files) end + + context 'with pending destruction package files' do + let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: public_package_with_same_codename) } + + it 'does not return them' do + expect(subject.to_a).not_to include(package_file_pending_destruction) + end + + context 'with packages_installable_package_files disabled' do + before do + stub_feature_flags(packages_installable_package_files: false) + end + + it 'returns them' do + subject + + expect(subject.to_a).to include(package_file_pending_destruction) + end + end + end end end end |