summaryrefslogtreecommitdiff
path: root/spec/services/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 21:20:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 21:20:15 +0000
commit92d5172ad42ebc62eb78cac21b1e236ad6ace580 (patch)
treeca89437d4725caeb4e27682522061d3bab7e05b0 /spec/services/ci
parentf4a969f7f495978a7e656c69c929c9fdac111cff (diff)
downloadgitlab-ce-92d5172ad42ebc62eb78cac21b1e236ad6ace580.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/services/ci')
-rw-r--r--spec/services/ci/pipeline_trigger_service_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/services/ci/pipeline_trigger_service_spec.rb b/spec/services/ci/pipeline_trigger_service_spec.rb
index 18fab9623ec..ac077e3c30e 100644
--- a/spec/services/ci/pipeline_trigger_service_spec.rb
+++ b/spec/services/ci/pipeline_trigger_service_spec.rb
@@ -106,9 +106,23 @@ RSpec.describe Ci::PipelineTriggerService do
let(:params) { { token: job.token, ref: 'master', variables: nil } }
let(:job) { create(:ci_build, :success, pipeline: pipeline, user: user) }
- it 'does nothing' do
+ it 'does nothing', :aggregate_failures do
+ expect { result }.not_to change { Ci::Pipeline.count }
+ expect(result[:message]).to eq('Job is not running')
+ expect(result[:http_status]).to eq(401)
+ end
+ end
+
+ context 'when job does not have a project' do
+ let(:params) { { token: job.token, ref: 'master', variables: nil } }
+ let(:job) { create(:ci_build, status: :running, pipeline: pipeline, user: user) }
+
+ it 'does nothing', :aggregate_failures do
+ job.update!(project: nil)
+
expect { result }.not_to change { Ci::Pipeline.count }
- expect(result[:message]).to eq('400 Job has to be running')
+ expect(result[:message]).to eq('Project has been deleted!')
+ expect(result[:http_status]).to eq(401)
end
end