diff options
| author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-07 08:32:45 +0000 |
|---|---|---|
| committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-05-07 08:32:45 +0000 |
| commit | d840535c3308b66dbd0f6d030af665ffb06edcd4 (patch) | |
| tree | 98c0c634028fbf09bc01308f2e6bf485e021ddd2 /spec/controllers | |
| parent | 67c9f822dd60ef55323082cd0b17ccd6108a24c6 (diff) | |
| parent | 7dabb22f22cee04113d45d56ed3fc06cd1ad93ea (diff) | |
| download | gitlab-ce-d840535c3308b66dbd0f6d030af665ffb06edcd4.tar.gz | |
Merge branch '33697-pipelines-json-endpoint' into 'master'
Resolve "CI retry/cancel job or pipeline redirect the user and can't be open in a new tab"
Closes #33697
See merge request gitlab-org/gitlab-ce!18451
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/projects/pipelines_controller_spec.rb | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 35ac999cc65..a451bbb97b6 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -109,8 +109,7 @@ describe Projects::PipelinesController do it 'returns html source for stage dropdown' do expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template('projects/pipelines/_stage') - expect(json_response).to include('html') + expect(response).to match_response_schema('pipeline_stage') end end @@ -133,6 +132,42 @@ describe Projects::PipelinesController do end end + describe 'GET stages_ajax.json' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + context 'when accessing existing stage' do + before do + create(:ci_build, pipeline: pipeline, stage: 'build') + + get_stage_ajax('build') + end + + it 'returns html source for stage dropdown' do + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template('projects/pipelines/_stage') + expect(json_response).to include('html') + end + end + + context 'when accessing unknown stage' do + before do + get_stage_ajax('test') + end + + it 'responds with not found' do + expect(response).to have_gitlab_http_status(:not_found) + end + end + + def get_stage_ajax(name) + get :stage_ajax, namespace_id: project.namespace, + project_id: project, + id: pipeline.id, + stage: name, + format: :json + end + end + describe 'GET status.json' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:status) { pipeline.detailed_status(double('user')) } |
