diff options
author | Tiger <twatson@gitlab.com> | 2019-03-12 17:37:37 +1100 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-03-20 12:04:46 +1100 |
commit | 759dab5b69f53a861045ebbc84836f83c7502af2 (patch) | |
tree | cf3860848dbcdd4f9b9011232d139b3cec5663a7 /spec/models/ci | |
parent | 42c6ccd2098ec98e5244e743a0c39634f076f66f (diff) | |
download | gitlab-ce-759dab5b69f53a861045ebbc84836f83c7502af2.tar.gz |
Add feature flag for build preparing state
The flag is on by default, but allows us to revert back
to the old behaviour if we encounter any problems.
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/build_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index b31c4fcceb3..7500e6ae5b1 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2919,6 +2919,36 @@ describe Ci::Build do end end + describe '#any_unmet_prerequisites?' do + let(:build) { create(:ci_build, :created) } + + subject { build.any_unmet_prerequisites? } + + context 'build has prerequisites' do + before do + allow(build).to receive(:prerequisites).and_return([double]) + end + + it { is_expected.to be_truthy } + + context 'and the ci_preparing_state feature is disabled' do + before do + stub_feature_flags(ci_preparing_state: false) + end + + it { is_expected.to be_falsey } + end + end + + context 'build does not have prerequisites' do + before do + allow(build).to receive(:prerequisites).and_return([]) + end + + it { is_expected.to be_falsey } + end + end + describe '#yaml_variables' do let(:build) { create(:ci_build, pipeline: pipeline, yaml_variables: variables) } |