Commit 3bceb45a authored by Kerri Miller's avatar Kerri Miller

Merge branch 'pl-speedup-project-helper' into 'master'

Speed up EE project helpers by using let_it_be for project factory

See merge request gitlab-org/gitlab!48891
parents d9252c0a 0171dac6
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe ProjectsHelper do
let(:project) { create(:project) }
let_it_be_with_refind(:project) { create(:project) }
before do
helper.instance_variable_set(:@project, project)
......@@ -40,13 +40,11 @@ RSpec.describe ProjectsHelper do
describe '#show_compliance_framework_badge?' do
it 'returns false if compliance framework setting is not present' do
project = build(:project)
expect(helper.show_compliance_framework_badge?(project)).to be_falsey
end
it 'returns true if compliance framework setting is present' do
project = build(:project, :with_compliance_framework)
project = build_stubbed(:project, :with_compliance_framework)
expect(helper.show_compliance_framework_badge?(project)).to be_truthy
end
......@@ -276,8 +274,7 @@ RSpec.describe ProjectsHelper do
end
with_them do
let(:project) { create(:project) }
let(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
allow(helper).to receive(:can?) { false }
......@@ -416,11 +413,12 @@ RSpec.describe ProjectsHelper do
describe '#show_discover_project_security?' do
using RSpec::Parameterized::TableSyntax
let(:user) { create(:user) }
let_it_be(:user) { create(:user) }
where(
gitlab_com?: [true, false],
user?: [true, false],
user?: [true, false],
security_dashboard_feature_available?: [true, false],
can_admin_namespace?: [true, false]
)
......
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