diff options
Diffstat (limited to 'spec/helpers/nav_helper_spec.rb')
-rw-r--r-- | spec/helpers/nav_helper_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb index 882a125a0da..8d7572c5b5f 100644 --- a/spec/helpers/nav_helper_spec.rb +++ b/spec/helpers/nav_helper_spec.rb @@ -42,6 +42,7 @@ describe NavHelper, :do_not_mock_admin_mode do context 'with admin mode enabled' do before do + current_user_mode.request_admin_mode! current_user_mode.enable_admin_mode!(password: user.password) end @@ -62,6 +63,7 @@ describe NavHelper, :do_not_mock_admin_mode do context 'with admin mode enabled' do before do + current_user_mode.request_admin_mode! current_user_mode.enable_admin_mode!(password: user.password) end @@ -89,11 +91,18 @@ describe NavHelper, :do_not_mock_admin_mode do end end - it 'returns only the sign in and search when the user is not logged in' do - allow(helper).to receive(:current_user).and_return(nil) - allow(helper).to receive(:can?).with(nil, :read_cross_project) { true } + context 'when the user is not logged in' do + let(:current_user_mode) { Gitlab::Auth::CurrentUserMode.new(nil) } - expect(helper.header_links).to contain_exactly(:sign_in, :search) + before do + allow(helper).to receive(:current_user).and_return(nil) + allow(helper).to receive(:current_user_mode).and_return(current_user_mode) + allow(helper).to receive(:can?).with(nil, :read_cross_project) { true } + end + + it 'returns only the sign in and search when the user is not logged in' do + expect(helper.header_links).to contain_exactly(:sign_in, :search) + end end end |