diff options
Diffstat (limited to 'spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb index d576a5874fd..9385706d991 100644 --- a/spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb @@ -38,4 +38,28 @@ RSpec.shared_examples 'a package with files' do 'fileSha256' => first_file.file_sha256 ) end + + context 'with package files pending destruction' do + let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: package) } + + let(:response_package_file_ids) { package_files_response.map { |pf| pf['id'] } } + + it 'does not return them' do + expect(package.reload.package_files).to include(package_file_pending_destruction) + + expect(response_package_file_ids).not_to include(package_file_pending_destruction.to_global_id.to_s) + end + + context 'with packages_installable_package_files disabled' do + before(:context) do + stub_feature_flags(packages_installable_package_files: false) + end + + it 'returns them' do + expect(package.reload.package_files).to include(package_file_pending_destruction) + + expect(response_package_file_ids).to include(package_file_pending_destruction.to_global_id.to_s) + end + end + end end |