Commit e2d2bbcc authored by Allison Browne's avatar Allison Browne

Fix delete pipeline feature spec

parent 060d64bf
...@@ -9,7 +9,7 @@ module Ci ...@@ -9,7 +9,7 @@ module Ci
pipeline.cancel_running if pipeline.cancelable? && ::Feature.enabled?(:cancel_pipelines_prior_to_destroy, default_enabled: :yaml) pipeline.cancel_running if pipeline.cancelable? && ::Feature.enabled?(:cancel_pipelines_prior_to_destroy, default_enabled: :yaml)
pipeline.destroy! pipeline.reset.destroy!
ServiceResponse.success(message: 'Pipeline not found') ServiceResponse.success(message: 'Pipeline not found')
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
......
...@@ -434,30 +434,44 @@ RSpec.describe 'Pipeline', :js do ...@@ -434,30 +434,44 @@ RSpec.describe 'Pipeline', :js do
end end
end end
context 'deleting pipeline' do shared_context 'delete pipeline' do
context 'when user can not delete' do context 'deleting pipeline' do
before do context 'when user can not delete' do
visit_pipeline before do
visit_pipeline
end
it { expect(page).not_to have_button('Delete') }
end end
it { expect(page).not_to have_button('Delete') } context 'when deleting' do
end before do
group.add_owner(user)
context 'when deleting' do visit_pipeline
before do
group.add_owner(user)
visit_pipeline click_button 'Delete'
click_button 'Delete pipeline'
end
click_button 'Delete' it 'redirects to pipeline overview page', :sidekiq_inline do
click_button 'Delete pipeline' expect(page).to have_content('The pipeline has been deleted')
expect(current_path).to eq(project_pipelines_path(project))
end
end end
end
end
it 'redirects to pipeline overview page', :sidekiq_might_not_need_inline do context 'when cancel_pipelines_prior_to_destroy is enabled' do
expect(page).to have_content('The pipeline has been deleted') include_context 'delete pipeline'
expect(current_path).to eq(project_pipelines_path(project)) end
end
context 'when cancel_pipelines_prior_to_destroy is disabled' do
before do
stub_feature_flags(cancel_pipelines_prior_to_destroy: false)
end end
include_context 'delete pipeline'
end end
context 'when pipeline ref does not exist in repository anymore' do context 'when pipeline ref does not exist in repository anymore' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment