Commit 6707bc56 authored by Dallas Reedy's avatar Dallas Reedy Committed by charlie ablett

Add spec for instance_review_permitted?

parent 126bb14e
......@@ -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