diff options
Diffstat (limited to 'spec/support/shared_examples/features/container_registry_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/container_registry_shared_examples.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/container_registry_shared_examples.rb b/spec/support/shared_examples/features/container_registry_shared_examples.rb index 06b2b8c621c..6aa7e6e6270 100644 --- a/spec/support/shared_examples/features/container_registry_shared_examples.rb +++ b/spec/support/shared_examples/features/container_registry_shared_examples.rb @@ -7,3 +7,20 @@ RSpec.shared_examples 'handling feature network errors with the container regist expect(page).to have_content 'We are having trouble connecting to the Container Registry' end end + +RSpec.shared_examples 'rejecting tags destruction for an importing repository on' do |tags: []| + it 'rejects the tag destruction operation' do + service = instance_double('Projects::ContainerRepository::DeleteTagsService') + expect(service).to receive(:execute).with(container_repository) { { status: :error, message: 'repository importing' } } + expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(container_repository.project, user, tags: tags) { service } + + first('[data-testid="additional-actions"]').click + first('[data-testid="single-delete-button"]').click + expect(find('.modal .modal-title')).to have_content _('Remove tag') + find('.modal .modal-footer .btn-danger').click + + alert_body = find('.gl-alert-body') + expect(alert_body).to have_content('Tags temporarily cannot be marked for deletion. Please try again in a few minutes.') + expect(alert_body).to have_link('More details', href: help_page_path('user/packages/container_registry/index', anchor: 'tags-temporarily-cannot-be-marked-for-deletion')) + end +end |