Commit edf33b39 authored by Kamil Trzciński's avatar Kamil Trzciński

Fix spec failures

parent 0d4b7155
......@@ -584,12 +584,12 @@ module Ci
end
def has_valid_build_dependencies?
return true unless Feature.enabled?('ci_disable_validates_dependencies')
return true if Feature.enabled?('ci_disable_validates_dependencies')
dependencies.all?(&:is_valid_dependency?)
dependencies.all?(&:valid_dependency?)
end
def is_valid_dependency?
def valid_dependency?
return false if artifacts_expired?
return false if erased?
......
......@@ -2416,13 +2416,13 @@ describe Ci::Build do
context 'when depended job has not been completed yet' do
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
it { expect { job.run! }.to have_valid_build_dependencies }
it { expect(job).to have_valid_build_dependencies }
end
context 'when artifacts of depended job has been expired' do
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
it { expect { job.run! }.not_to have_valid_build_dependencies }
it { expect(job).not_to have_valid_build_dependencies }
end
context 'when artifacts of depended job has been erased' do
......@@ -2432,7 +2432,7 @@ describe Ci::Build do
pre_stage_job.erase
end
it { expect { job.run! }.not_to have_valid_build_dependencies }
it { expect(job).not_to have_valid_build_dependencies }
end
end
......@@ -2440,12 +2440,13 @@ describe Ci::Build do
context 'when depended job has not been completed yet' do
let!(:pre_stage_job) { create(:ci_build, :manual, pipeline: pipeline, name: 'test', stage_idx: 0) }
it { expect { job.run! }.to have_valid_build_dependencies }
it { expect(job).to have_valid_build_dependencies }
end
context 'when artifacts of depended job has been expired' do
let!(:pre_stage_job) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test', stage_idx: 0) }
it { expect { job.run! }.to have_valid_build_dependencies }
it { expect(job).to have_valid_build_dependencies }
end
context 'when artifacts of depended job has been erased' do
......@@ -2455,7 +2456,7 @@ describe Ci::Build do
pre_stage_job.erase
end
it { expect { job.run! }.to have_valid_build_dependencies }
it { expect(job).to have_valid_build_dependencies }
end
end
......@@ -2471,13 +2472,13 @@ describe Ci::Build do
context 'when "dependencies" keyword is not defined' do
let(:options) { {} }
it { expect { job.run! }.not_to raise_error }
it { expect(job).to have_valid_build_dependencies }
end
context 'when "dependencies" keyword is empty' do
let(:options) { { dependencies: [] } }
it { expect { job.run! }.not_to raise_error }
it { expect(job).to have_valid_build_dependencies }
end
context 'when "dependencies" keyword is specified' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment