summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-09-05 22:37:28 +0900
committerShinya Maeda <shinya@gitlab.com>2017-12-06 15:53:59 +0900
commitc3e0731d2efc777018b668d9e0b7f8aa2377d9fc (patch)
treefcfbec6c06c4a4052716120f58dd140363339ae0 /spec/models
parent6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3 (diff)
downloadgitlab-ce-c3e0731d2efc777018b668d9e0b7f8aa2377d9fc.tar.gz
Add case when artifacts have not existed on dependencies
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/build_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index f8d8b1800b8..230546cf2da 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -1887,9 +1887,28 @@ describe Ci::Build do
let(:options) { { dependencies: ['test'] } }
context 'when a depended job exists' do
- let!(:pre_build) { create(:ci_build, pipeline: pipeline, name: 'test', stage_idx: 0) }
+ let!(:pre_stage_job) { create(:ci_build, pipeline: pipeline, name: 'test', stage_idx: 0) }
it { expect { build.run! }.not_to raise_error }
+
+ context 'when "artifacts" keyword is specified on depended job' do
+ let!(:pre_stage_job) do
+ create(:ci_build, :artifacts, pipeline: pipeline, name: 'test', stage_idx: 0,
+ options: { artifacts: { paths: ['binaries/'] } } )
+ end
+
+ context 'when artifacts of depended job has existsed' do
+ it { expect { build.run! }.not_to raise_error }
+ end
+
+ context 'when artifacts of depended job has not existsed' do
+ before do
+ pre_stage_job.erase_artifacts!
+ end
+
+ it { expect { build.run! }.to raise_error(Ci::Build::MissingDependenciesError) }
+ end
+ end
end
context 'when depended jobs do not exist' do