Commit bd9bb5c8 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'pl-spec-pipeline-presenter-perf' into 'master'

Speed up pipeline presenter specs

See merge request gitlab-org/gitlab!43035
parents 047a3c49 c4434c65
...@@ -5,17 +5,20 @@ require 'spec_helper' ...@@ -5,17 +5,20 @@ require 'spec_helper'
RSpec.describe Ci::PipelinePresenter do RSpec.describe Ci::PipelinePresenter do
include Gitlab::Routing include Gitlab::Routing
let(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be_with_reload(:project) { create(:project, :test_repo) }
let_it_be_with_reload(:pipeline) { create(:ci_pipeline, project: project) }
let(:current_user) { user } let(:current_user) { user }
let(:project) { create(:project, :test_repo) }
let(:pipeline) { create(:ci_pipeline, project: project) }
subject(:presenter) do subject(:presenter) do
described_class.new(pipeline) described_class.new(pipeline)
end end
before do before_all do
project.add_developer(user) project.add_developer(user)
end
before do
allow(presenter).to receive(:current_user) { current_user } allow(presenter).to receive(:current_user) { current_user }
end end
...@@ -184,8 +187,8 @@ RSpec.describe Ci::PipelinePresenter do ...@@ -184,8 +187,8 @@ RSpec.describe Ci::PipelinePresenter do
describe '#all_related_merge_request_text' do describe '#all_related_merge_request_text' do
subject { presenter.all_related_merge_request_text } subject { presenter.all_related_merge_request_text }
let(:mr_1) { create(:merge_request) } let_it_be(:mr_1) { create(:merge_request) }
let(:mr_2) { create(:merge_request) } let_it_be(:mr_2) { create(:merge_request) }
context 'with zero related merge requests (branch pipeline)' do context 'with zero related merge requests (branch pipeline)' do
it { is_expected.to eq('No related merge requests found.') } it { is_expected.to eq('No related merge requests found.') }
...@@ -242,7 +245,7 @@ RSpec.describe Ci::PipelinePresenter do ...@@ -242,7 +245,7 @@ RSpec.describe Ci::PipelinePresenter do
end end
context 'permissions' do context 'permissions' do
let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline, source_project: project) } let_it_be_with_refind(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline, source_project: project) }
let(:pipeline) { merge_request.all_pipelines.take } let(:pipeline) { merge_request.all_pipelines.take }
shared_examples 'private merge requests' do shared_examples 'private merge requests' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment