From 469a50879c1085ec77c95d650b7f135fee2c9e13 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 8 Jan 2021 00:32:37 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-7-stable-ee --- spec/controllers/projects/jobs_controller_spec.rb | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'spec/controllers/projects/jobs_controller_spec.rb') diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 3309b15b276..eb5e62f3d44 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -700,10 +700,22 @@ RSpec.describe Projects::JobsController, :clean_gitlab_redis_shared_state do expect(json_response['lines']).to eq [{ 'content' => [{ 'text' => 'BUILD TRACE' }], 'offset' => 0 }] end - it 'sets being-watched flag for the job' do - expect(response).to have_gitlab_http_status(:ok) + context 'when job is running' do + let(:job) { create(:ci_build, :trace_live, :running, pipeline: pipeline) } + + it 'sets being-watched flag for the job' do + expect(response).to have_gitlab_http_status(:ok) + + expect(job.trace.being_watched?).to be(true) + end + end - expect(job.trace.being_watched?).to be(true) + context 'when job is not running' do + it 'does not set being-watched flag for the job' do + expect(response).to have_gitlab_http_status(:ok) + + expect(job.trace.being_watched?).to be(false) + end end end @@ -711,11 +723,7 @@ RSpec.describe Projects::JobsController, :clean_gitlab_redis_shared_state do let(:job) { create(:ci_build, pipeline: pipeline) } it 'returns no traces' do - expect(response).to have_gitlab_http_status(:ok) - expect(response).to match_response_schema('job/build_trace') - expect(json_response['id']).to eq job.id - expect(json_response['status']).to eq job.status - expect(json_response['lines']).to be_nil + expect(response).to have_gitlab_http_status(:no_content) end end -- cgit v1.2.1