Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/sidebars_helper_spec.rb')
-rw-r--r--spec/helpers/sidebars_helper_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/helpers/sidebars_helper_spec.rb b/spec/helpers/sidebars_helper_spec.rb
index c9131ca518f..421b1c178aa 100644
--- a/spec/helpers/sidebars_helper_spec.rb
+++ b/spec/helpers/sidebars_helper_spec.rb
@@ -131,8 +131,10 @@ RSpec.describe SidebarsHelper, feature_category: :navigation do
it 'returns sidebar values from user', :use_clean_rails_memory_store_caching do
expect(subject).to include({
is_logged_in: true,
+ is_admin: false,
name: user.name,
username: user.username,
+ admin_url: admin_root_url,
avatar_url: user.avatar_url,
has_link_to_profile: helper.current_user_menu?(:profile),
link_to_profile: user_path(user),
@@ -174,6 +176,14 @@ RSpec.describe SidebarsHelper, feature_category: :navigation do
})
end
+ context 'when user is admin' do
+ before do
+ allow(user).to receive(:can_admin_all_resources?).and_return(true)
+ end
+
+ it { is_expected.to include({ is_admin: true }) }
+ end
+
describe "shortcut links" do
describe "as the anonymous user" do
let_it_be(:user) { nil }