diff options
author | Mike Wyatt <wyatt.mike@gmail.com> | 2017-04-05 12:07:10 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-04-05 12:07:10 +0000 |
commit | 31b8287a1b4cc5ee4424c35045fa4540e9665184 (patch) | |
tree | 160f2c7416b8646dcb33091cfd9daa66180dd31a /spec | |
parent | 10a77824e1f0c687a7293a8cb2e8d85665121e45 (diff) | |
download | gitlab-ce-31b8287a1b4cc5ee4424c35045fa4540e9665184.tar.gz |
Return an empty array when dependencies is an empty array
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/runner_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 044b989e5ba..1cfac7353d4 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -461,6 +461,29 @@ describe API::Runner do end end + context 'when dependencies is an empty array' do + let!(:job) { create(:ci_build_tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } + let!(:job2) { create(:ci_build_tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) } + let!(:empty_dependencies_job) do + create(:ci_build, pipeline: pipeline, token: 'test-job-token', name: 'empty_dependencies_job', + stage: 'deploy', stage_idx: 1, + options: { dependencies: [] }) + end + + before do + job.success + job2.success + end + + it 'returns an empty array' do + request_job + + expect(response).to have_http_status(201) + expect(json_response['id']).to eq(empty_dependencies_job.id) + expect(json_response['dependencies'].count).to eq(0) + end + end + context 'when job has no tags' do before { job.update(tags: []) } |