diff options
Diffstat (limited to 'spec/lib/gitlab/ci/status/bridge/factory_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/status/bridge/factory_spec.rb | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/spec/lib/gitlab/ci/status/bridge/factory_spec.rb b/spec/lib/gitlab/ci/status/bridge/factory_spec.rb index c13901a4776..040c3ec7f6e 100644 --- a/spec/lib/gitlab/ci/status/bridge/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/bridge/factory_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Gitlab::Ci::Status::Bridge::Factory, feature_category: :continuou expect(status.text).to eq s_('CiStatusText|created') expect(status.icon).to eq 'status_created' expect(status.favicon).to eq 'favicon_status_created' - expect(status.label).to be_nil + expect(status.label).to eq 'created' expect(status).not_to have_details expect(status).not_to have_action end @@ -40,7 +40,8 @@ RSpec.describe Gitlab::Ci::Status::Bridge::Factory, feature_category: :continuou it 'matches correct extended statuses' do expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Bridge::Failed] + .to eq [Gitlab::Ci::Status::Bridge::Retryable, + Gitlab::Ci::Status::Bridge::Failed] end it 'fabricates a failed bridge status' do @@ -51,10 +52,10 @@ RSpec.describe Gitlab::Ci::Status::Bridge::Factory, feature_category: :continuou expect(status.text).to eq s_('CiStatusText|failed') expect(status.icon).to eq 'status_failed' expect(status.favicon).to eq 'favicon_status_failed' - expect(status.label).to be_nil + expect(status.label).to eq 'failed' expect(status.status_tooltip).to eq "#{s_('CiStatusText|failed')} - (unknown failure)" expect(status).not_to have_details - expect(status).not_to have_action + expect(status).to have_action end context 'failed with downstream_pipeline_creation_failed' do @@ -130,12 +131,36 @@ RSpec.describe Gitlab::Ci::Status::Bridge::Factory, feature_category: :continuou expect(status.text).to eq 'waiting' expect(status.group).to eq 'waiting-for-resource' expect(status.icon).to eq 'status_pending' - expect(status.favicon).to eq 'favicon_pending' + expect(status.favicon).to eq 'favicon_status_pending' expect(status.illustration).to include(:image, :size, :title) expect(status).not_to have_details end end + context 'when the bridge is successful and therefore retryable' do + let(:bridge) { create(:ci_bridge, :success) } + + it 'matches correct core status' do + expect(factory.core_status).to be_a Gitlab::Ci::Status::Success + end + + it 'matches correct extended statuses' do + expect(factory.extended_statuses) + .to eq [Gitlab::Ci::Status::Bridge::Retryable] + end + + it 'fabricates a retryable build status' do + expect(status).to be_a Gitlab::Ci::Status::Bridge::Retryable + end + + it 'fabricates status with correct details' do + expect(status.text).to eq s_('CiStatusText|passed') + expect(status.icon).to eq 'status_success' + expect(status.favicon).to eq 'favicon_status_success' + expect(status).to have_action + end + end + private def create_bridge(*traits) |