summaryrefslogtreecommitdiff
path: root/spec/helpers/application_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /spec/helpers/application_helper_spec.rb
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r--spec/helpers/application_helper_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index ce4e73bdc55..a557e9e04da 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -222,6 +222,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 '#locale_path' do
it 'returns the locale path with an `_`' do
Gitlab::I18n.with_locale('pt-BR') do