Commit ebf10530 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'pl-spec-finders-group-projects-perf' into 'master'

Speed up group finder specs by using let_it_be in shared context

See merge request gitlab-org/gitlab!46096
parents d2d56ef1 6595e355
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_context 'GroupProjectsFinder context' do RSpec.shared_context 'GroupProjectsFinder context' do
let(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:subgroup) { create(:group, parent: group) } let_it_be(:subgroup) { create(:group, parent: group) }
let(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
let(:params) { {} } let(:params) { {} }
let(:options) { {} } let(:options) { {} }
let(:finder) { described_class.new(group: group, current_user: current_user, params: params, options: options) } let(:finder) { described_class.new(group: group, current_user: current_user, params: params, options: options) }
let!(:public_project) { create(:project, :public, group: group, path: '1') } let_it_be(:public_project) { create(:project, :public, group: group, path: '1') }
let!(:private_project) { create(:project, :private, group: group, path: '2') } let_it_be(:private_project) { create(:project, :private, group: group, path: '2') }
let!(:shared_project_1) { create(:project, :public, path: '3') } let_it_be(:shared_project_1) { create(:project, :public, path: '3') }
let!(:shared_project_2) { create(:project, :private, path: '4') } let_it_be(:shared_project_2) { create(:project, :private, path: '4') }
let!(:shared_project_3) { create(:project, :internal, path: '5') } let_it_be(:shared_project_3) { create(:project, :internal, path: '5') }
let!(:subgroup_project) { create(:project, :public, path: '6', group: subgroup) } let_it_be(:subgroup_project) { create(:project, :public, path: '6', group: subgroup) }
let!(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup) } let_it_be(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup) }
before do before do
shared_project_1.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group) shared_project_1.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group)
......
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