summaryrefslogtreecommitdiff
path: root/spec/features/projects/pipelines/pipeline_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/pipelines/pipeline_spec.rb')
-rw-r--r--spec/features/projects/pipelines/pipeline_spec.rb68
1 files changed, 45 insertions, 23 deletions
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb
index 70dc0bd04e8..0958e1d1891 100644
--- a/spec/features/projects/pipelines/pipeline_spec.rb
+++ b/spec/features/projects/pipelines/pipeline_spec.rb
@@ -7,7 +7,8 @@ RSpec.describe 'Pipeline', :js do
include ProjectForksHelper
include ::ExclusiveLeaseHelpers
- let(:project) { create(:project) }
+ let_it_be(:project) { create(:project) }
+
let(:user) { create(:user) }
let(:role) { :developer }
@@ -59,8 +60,9 @@ RSpec.describe 'Pipeline', :js do
describe 'GET /:project/-/pipelines/:id' do
include_context 'pipeline builds'
- let(:group) { create(:group) }
- let(:project) { create(:project, :repository, group: group) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project, reload: true) { create(:project, :repository, group: group) }
+
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
subject(:visit_pipeline) { visit project_pipeline_path(project, pipeline) }
@@ -246,6 +248,8 @@ RSpec.describe 'Pipeline', :js do
end
context 'when pipeline has a delayed job' do
+ let(:project) { create(:project, :repository, group: group) }
+
it 'shows the scheduled icon and an unschedule action for the delayed job' do
page.within('#ci-badge-delayed-job') do
expect(page).to have_selector('.js-ci-status-icon-scheduled')
@@ -434,30 +438,44 @@ RSpec.describe 'Pipeline', :js do
end
end
- context 'deleting pipeline' do
- context 'when user can not delete' do
- before do
- visit_pipeline
+ shared_context 'delete pipeline' do
+ context 'deleting pipeline' do
+ context 'when user can not delete' do
+ before do
+ visit_pipeline
+ end
+
+ it { expect(page).not_to have_button('Delete') }
end
- it { expect(page).not_to have_button('Delete') }
- end
+ context 'when deleting' do
+ before do
+ group.add_owner(user)
- context 'when deleting' do
- before do
- group.add_owner(user)
+ visit_pipeline
- visit_pipeline
+ click_button 'Delete'
+ click_button 'Delete pipeline'
+ end
- click_button 'Delete'
- click_button 'Delete pipeline'
+ it 'redirects to pipeline overview page', :sidekiq_inline do
+ expect(page).to have_content('The pipeline has been deleted')
+ expect(current_path).to eq(project_pipelines_path(project))
+ end
end
+ end
+ end
- it 'redirects to pipeline overview page', :sidekiq_might_not_need_inline do
- expect(page).to have_content('The pipeline has been deleted')
- expect(current_path).to eq(project_pipelines_path(project))
- end
+ context 'when cancel_pipelines_prior_to_destroy is enabled' do
+ include_context 'delete pipeline'
+ end
+
+ context 'when cancel_pipelines_prior_to_destroy is disabled' do
+ before do
+ stub_feature_flags(cancel_pipelines_prior_to_destroy: false)
end
+
+ include_context 'delete pipeline'
end
context 'when pipeline ref does not exist in repository anymore' do
@@ -550,6 +568,7 @@ RSpec.describe 'Pipeline', :js do
end
context 'when pipeline is merge request pipeline' do
+ let(:project) { create(:project, :repository, group: group) }
let(:source_project) { project }
let(:target_project) { project }
@@ -634,7 +653,8 @@ RSpec.describe 'Pipeline', :js do
describe 'GET /:project/-/pipelines/:id' do
include_context 'pipeline builds'
- let(:project) { create(:project, :repository) }
+ let_it_be(:project) { create(:project, :repository) }
+
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
before do
@@ -997,7 +1017,8 @@ RSpec.describe 'Pipeline', :js do
describe 'GET /:project/-/pipelines/:id/builds' do
include_context 'pipeline builds'
- let(:project) { create(:project, :repository) }
+ let_it_be(:project) { create(:project, :repository) }
+
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
before do
@@ -1234,7 +1255,8 @@ RSpec.describe 'Pipeline', :js do
describe 'GET /:project/-/pipelines/:id/dag' do
include_context 'pipeline builds'
- let(:project) { create(:project, :repository) }
+ let_it_be(:project) { create(:project, :repository) }
+
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
before do
@@ -1263,7 +1285,7 @@ RSpec.describe 'Pipeline', :js do
end
context 'when user sees pipeline flags in a pipeline detail page' do
- let(:project) { create(:project, :repository) }
+ let_it_be(:project) { create(:project, :repository) }
context 'when pipeline is latest' do
include_context 'pipeline builds'