2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'layouts/nav/sidebar/_profile' do
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_user).and_return(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'has nav sidebar'
|
2021-04-29 21:17:54 +05:30
|
|
|
it_behaves_like 'sidebar includes snowplow attributes', 'render', 'user_side_navigation', 'user_side_navigation'
|
2022-11-25 23:54:43 +05:30
|
|
|
|
|
|
|
it 'has a link to access tokens' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link(_('Access Tokens'), href: profile_personal_access_tokens_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when personal access tokens are disabled' do
|
|
|
|
it 'does not have a link to access tokens' do
|
|
|
|
allow(::Gitlab::CurrentSettings).to receive_messages(personal_access_tokens_disabled?: true)
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_link(_('Access Tokens'), href: profile_personal_access_tokens_path)
|
|
|
|
end
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|