diff options
Diffstat (limited to 'spec/controllers/projects/pipelines_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/pipelines_controller_spec.rb | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 8fae82d54a2..1be4177acd1 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -19,6 +19,27 @@ RSpec.describe Projects::PipelinesController do sign_in(user) end + shared_examples 'the show page' do |param| + it 'redirects to pipeline path with param' do + get param, params: { namespace_id: project.namespace, project_id: project, id: pipeline } + + expect(response).to redirect_to(pipeline_path(pipeline, tab: param)) + end + + context 'when the FF pipeline_tabs_vue is disabled' do + before do + stub_feature_flags(pipeline_tabs_vue: false) + end + + it 'renders the show template' do + get param, params: { namespace_id: project.namespace, project_id: project, id: pipeline } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template :show + end + end + end + describe 'GET index.json' do before do create_all_pipeline_types @@ -625,6 +646,12 @@ RSpec.describe Projects::PipelinesController do end end + describe 'GET dag' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + it_behaves_like 'the show page', 'dag' + end + describe 'GET dag.json' do let(:pipeline) { create(:ci_pipeline, project: project) } @@ -658,6 +685,49 @@ RSpec.describe Projects::PipelinesController do end end + describe 'GET builds' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + it_behaves_like 'the show page', 'builds' + end + + describe 'GET failures' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + context 'with ff `pipeline_tabs_vue` disabled' do + before do + stub_feature_flags(pipeline_tabs_vue: false) + end + + context 'with failed jobs' do + before do + create(:ci_build, :failed, pipeline: pipeline, name: 'hello') + end + + it 'shows the page' do + get :failures, params: { namespace_id: project.namespace, project_id: project, id: pipeline } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template :show + end + end + + context 'without failed jobs' do + it 'redirects to the main pipeline page' do + get :failures, params: { namespace_id: project.namespace, project_id: project, id: pipeline } + + expect(response).to redirect_to(pipeline_path(pipeline)) + end + end + end + + it 'redirects to the pipeline page with `failures` query param' do + get :failures, params: { namespace_id: project.namespace, project_id: project, id: pipeline } + + expect(response).to redirect_to(pipeline_path(pipeline, tab: 'failures')) + end + end + describe 'GET stages.json' do let(:pipeline) { create(:ci_pipeline, project: project) } @@ -988,6 +1058,12 @@ RSpec.describe Projects::PipelinesController do end end + describe 'GET test_report' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + it_behaves_like 'the show page', 'test_report' + end + describe 'GET test_report.json' do let(:pipeline) { create(:ci_pipeline, project: project) } |