diff options
author | Steve Azzopardi <steveazz@outlook.com> | 2018-10-31 09:44:22 +0100 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-10-31 16:57:46 +0100 |
commit | 8f36f1cad215ac1bc37bd203f69bc0c56847e85b (patch) | |
tree | 125da34468e0d7875b6c05fb54e07f337d300b04 /spec/controllers/projects/jobs_controller_spec.rb | |
parent | 98a504ecbb45907517ae465018906af7ef4573de (diff) | |
download | gitlab-ce-8f36f1cad215ac1bc37bd203f69bc0c56847e85b.tar.gz |
Send continue parameter on for cancel_path
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21595
`ContinueParams` was introducted in the `Projects::JobController#cancel`
since `continue` parameter is not present for in `cancel_path` for
`Projects::JobController#show.sjon` the user is being redirect to the
pipeline page, where it should be redirected to the current job page
instead.
Add the `continue` parameter as a query string for `cancel_path`.
Diffstat (limited to 'spec/controllers/projects/jobs_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/jobs_controller_spec.rb | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 2023d4b0bd0..2efae59caae 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -157,6 +157,28 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do end end + context 'when job is running' do + context 'job is cancelable' do + let(:job) { create(:ci_build, :running, pipeline: pipeline) } + + it 'cancel_path is present with correct redirect' do + expect(response).to have_gitlab_http_status(:ok) + expect(response).to match_response_schema('job/job_details') + expect(json_response['cancel_path']).to include(CGI.escape(json_response['build_path'])) + end + end + + context 'with web terminal' do + let(:job) { create(:ci_build, :running, :with_runner_session, pipeline: pipeline) } + + it 'exposes the terminal path' do + expect(response).to have_gitlab_http_status(:ok) + expect(response).to match_response_schema('job/job_details') + expect(json_response['terminal_path']).to match(%r{/terminal}) + end + end + end + context 'when job has artifacts' do context 'with not expiry date' do let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) } @@ -185,16 +207,6 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do end end - context 'when job has terminal' do - let(:job) { create(:ci_build, :running, :with_runner_session, pipeline: pipeline) } - - it 'exposes the terminal path' do - expect(response).to have_gitlab_http_status(:ok) - expect(response).to match_response_schema('job/job_details') - expect(json_response['terminal_path']).to match(%r{/terminal}) - end - end - context 'when job passed with no trace' do let(:job) { create(:ci_build, :success, :artifacts, pipeline: pipeline) } |