diff options
Diffstat (limited to 'spec/models/ci/stage_spec.rb')
-rw-r--r-- | spec/models/ci/stage_spec.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index 3d387d52c8e..cca0cb1e3b0 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -168,13 +168,23 @@ describe Ci::Stage, models: true do describe '#has_warnings?' do context 'when stage has warnings' do - before do - create(:ci_build, :failed, :allowed_to_fail, - stage: stage_name, pipeline: pipeline) + context 'when using memoized warnings flag' do + let(:stage) { build(:ci_stage, warnings: true) } + + it 'has warnings' do + expect(stage).to have_warnings + end end - it 'has warnings' do - expect(stage).to have_warnings + context 'when calculating warnings from statuses' do + before do + create(:ci_build, :failed, :allowed_to_fail, + stage: stage_name, pipeline: pipeline) + end + + it 'has warnings' do + expect(stage).to have_warnings + end end end |