From b595cb0c1dec83de5bdee18284abe86614bed33b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 Jul 2022 15:40:28 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-2-stable-ee --- spec/lib/gitlab/ci/status/stage/factory_spec.rb | 20 +++++--------------- spec/lib/gitlab/ci/status/stage/play_manual_spec.rb | 10 +++++----- 2 files changed, 10 insertions(+), 20 deletions(-) (limited to 'spec/lib/gitlab/ci/status') diff --git a/spec/lib/gitlab/ci/status/stage/factory_spec.rb b/spec/lib/gitlab/ci/status/stage/factory_spec.rb index e0f5531f370..35d44281072 100644 --- a/spec/lib/gitlab/ci/status/stage/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/factory_spec.rb @@ -7,9 +7,7 @@ RSpec.describe Gitlab::Ci::Status::Stage::Factory do let(:project) { create(:project) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } - let(:stage) do - build(:ci_stage, pipeline: pipeline, name: 'test') - end + let(:stage) { create(:ci_stage, pipeline: pipeline) } subject do described_class.new(stage, user) @@ -26,11 +24,7 @@ RSpec.describe Gitlab::Ci::Status::Stage::Factory do context 'when stage has a core status' do (Ci::HasStatus::AVAILABLE_STATUSES - %w(manual skipped scheduled)).each do |core_status| context "when core status is #{core_status}" do - before do - create(:ci_build, pipeline: pipeline, stage: 'test', status: core_status) - create(:commit_status, pipeline: pipeline, stage: 'test', status: core_status) - create(:ci_build, pipeline: pipeline, stage: 'build', status: :failed) - end + let(:stage) { create(:ci_stage, pipeline: pipeline, status: core_status) } it "fabricates a core status #{core_status}" do expect(status).to be_a( @@ -48,12 +42,12 @@ RSpec.describe Gitlab::Ci::Status::Stage::Factory do context 'when stage has warnings' do let(:stage) do - build(:ci_stage, name: 'test', status: :success, pipeline: pipeline) + create(:ci_stage, status: :success, pipeline: pipeline) end before do create(:ci_build, :allowed_to_fail, :failed, - stage: 'test', pipeline: stage.pipeline) + stage_id: stage.id, pipeline: stage.pipeline) end it 'fabricates extended "success with warnings" status' do @@ -70,11 +64,7 @@ RSpec.describe Gitlab::Ci::Status::Stage::Factory do context 'when stage has manual builds' do (Ci::HasStatus::BLOCKED_STATUS + ['skipped']).each do |core_status| context "when status is #{core_status}" do - before do - create(:ci_build, pipeline: pipeline, stage: 'test', status: core_status) - create(:commit_status, pipeline: pipeline, stage: 'test', status: core_status) - create(:ci_build, pipeline: pipeline, stage: 'build', status: :manual) - end + let(:stage) { create(:ci_stage, pipeline: pipeline, status: core_status) } it 'fabricates a play manual status' do expect(status).to be_a(Gitlab::Ci::Status::Stage::PlayManual) diff --git a/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb b/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb index 25b79ff2099..9fdaddc083e 100644 --- a/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Gitlab::Ci::Status::Stage::PlayManual do end describe '#action_path' do - let(:stage) { create(:ci_stage_entity, status: 'manual') } + let(:stage) { create(:ci_stage, status: 'manual') } let(:pipeline) { stage.pipeline } let(:play_manual) { stage.detailed_status(create(:user)) } @@ -46,25 +46,25 @@ RSpec.describe Gitlab::Ci::Status::Stage::PlayManual do subject { described_class.matches?(stage, user) } context 'when stage is skipped' do - let(:stage) { create(:ci_stage_entity, status: :skipped) } + let(:stage) { create(:ci_stage, status: :skipped) } it { is_expected.to be_truthy } end context 'when stage is manual' do - let(:stage) { create(:ci_stage_entity, status: :manual) } + let(:stage) { create(:ci_stage, status: :manual) } it { is_expected.to be_truthy } end context 'when stage is scheduled' do - let(:stage) { create(:ci_stage_entity, status: :scheduled) } + let(:stage) { create(:ci_stage, status: :scheduled) } it { is_expected.to be_truthy } end context 'when stage is success' do - let(:stage) { create(:ci_stage_entity, status: :success) } + let(:stage) { create(:ci_stage, status: :success) } context 'and does not have manual builds' do it { is_expected.to be_falsy } -- cgit v1.2.3