summaryrefslogtreecommitdiff
path: root/spec/models/ci/build_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/build_spec.rb')
-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