diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-14 08:12:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-14 08:12:27 +0000 |
commit | 3772445de3063dda5e5fb2f21b6debf14032cc92 (patch) | |
tree | 8db2e49b644638f160392062221e6a0a56fcfd62 /spec/presenters | |
parent | 28a9333b4b418ce3f96fcd0a530d76ac86e6c4ed (diff) | |
download | gitlab-ce-3772445de3063dda5e5fb2f21b6debf14032cc92.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-ee
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/ci/stage_presenter_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/presenters/ci/stage_presenter_spec.rb b/spec/presenters/ci/stage_presenter_spec.rb new file mode 100644 index 00000000000..368f03b0150 --- /dev/null +++ b/spec/presenters/ci/stage_presenter_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::StagePresenter do + let(:stage) { create(:ci_stage) } + let(:presenter) { described_class.new(stage) } + + let!(:build) { create(:ci_build, :tags, :artifacts, pipeline: stage.pipeline, stage: stage.name) } + let!(:retried_build) { create(:ci_build, :tags, :artifacts, :retried, pipeline: stage.pipeline, stage: stage.name) } + + before do + create(:generic_commit_status, pipeline: stage.pipeline, stage: stage.name) + end + + shared_examples 'preloaded associations for CI status' do + it 'preloads project' do + expect(presented_stage.association(:project)).to be_loaded + end + + it 'preloads build pipeline' do + expect(presented_stage.association(:pipeline)).to be_loaded + end + + it 'preloads build tags' do + expect(presented_stage.association(:tags)).to be_loaded + end + + it 'preloads build artifacts archive' do + expect(presented_stage.association(:job_artifacts_archive)).to be_loaded + end + + it 'preloads build artifacts metadata' do + expect(presented_stage.association(:metadata)).to be_loaded + end + end + + describe '#latest_ordered_statuses' do + subject(:presented_stage) { presenter.latest_ordered_statuses.second } + + it_behaves_like 'preloaded associations for CI status' + end + + describe '#retried_ordered_statuses' do + subject(:presented_stage) { presenter.retried_ordered_statuses.first } + + it_behaves_like 'preloaded associations for CI status' + end +end |