Commit f418f720 authored by charlie ablett's avatar charlie ablett

Merge branch 'add-application-helper-spec-for-instance-review-permitted' into 'master'

Add spec for instance_review_permitted?

See merge request gitlab-org/gitlab!39161
parents 5fc2160f 6707bc56
......@@ -189,6 +189,32 @@ RSpec.describe ApplicationHelper do
end
end
describe '#instance_review_permitted?' do
let_it_be(:non_admin_user) { create :user }
let_it_be(:admin_user) { create :user, :admin }
before do
allow(::Gitlab::CurrentSettings).to receive(:instance_review_permitted?).and_return(app_setting)
allow(helper).to receive(:current_user).and_return(current_user)
end
subject { helper.instance_review_permitted? }
where(app_setting: [true, false], is_admin: [true, false, nil])
with_them do
let(:current_user) do
if is_admin.nil?
nil
else
is_admin ? admin_user : non_admin_user
end
end
it { is_expected.to be(app_setting && is_admin) }
end
end
describe '#show_whats_new_dropdown_item?' do
using RSpec::Parameterized::TableSyntax
......
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