summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/jobs_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-08 00:32:37 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-08 00:32:37 +0000
commit469a50879c1085ec77c95d650b7f135fee2c9e13 (patch)
tree0d639a63294b5abdb4e4a7bf1ed5a497d5e6869f /spec/controllers/projects/jobs_controller_spec.rb
parentaa5ca44f172f02f04cca448b1f9c17d6d933de40 (diff)
downloadgitlab-ce-469a50879c1085ec77c95d650b7f135fee2c9e13.tar.gz
Add latest changes from gitlab-org/gitlab@13-7-stable-ee
Diffstat (limited to 'spec/controllers/projects/jobs_controller_spec.rb')
-rw-r--r--spec/controllers/projects/jobs_controller_spec.rb24
1 files changed, 16 insertions, 8 deletions
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