diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 18:10:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 18:10:07 +0300 |
commit | c5e4f06c597e7ef9b584595a55a82cb221804e4b (patch) | |
tree | 2db854553738bf601a40d427dbb9eaf5516be027 /spec/views | |
parent | db36dea03b0e56ed242eb290c51be88ca4c61a65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb | 30 | ||||
-rw-r--r-- | spec/views/layouts/nav/sidebar/_project_security_link.html.haml_spec.rb | 29 |
2 files changed, 30 insertions, 29 deletions
diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 16362aed1cd..72b5b31bb7a 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -315,6 +315,36 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end end + describe 'Security and Compliance' do + describe 'when user does not have permissions' do + before do + allow(view).to receive(:current_user).and_return(nil) + end + + it 'top level navigation link is not visible' do + render + + expect(rendered).not_to have_link('Security & Compliance') + end + end + + context 'when user has permissions' do + before do + allow(view).to receive(:current_user).and_return(user) + + render + end + + it 'top level navigation link is visible' do + expect(rendered).to have_link('Security & Compliance') + end + + it 'security configuration link is visible' do + expect(rendered).to have_link('Configuration', href: project_security_configuration_path(project)) + end + end + end + describe 'packages tab' do before do stub_container_registry_config(enabled: true) diff --git a/spec/views/layouts/nav/sidebar/_project_security_link.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project_security_link.html.haml_spec.rb deleted file mode 100644 index d3fb35bff6d..00000000000 --- a/spec/views/layouts/nav/sidebar/_project_security_link.html.haml_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'layouts/nav/sidebar/_project_security_link' do - let_it_be_with_reload(:project) { create(:project) } - context 'on security configuration' do - before do - assign(:project, project) - allow(controller).to receive(:controller_name).and_return('configuration') - allow(controller).to receive(:controller_path).and_return('projects/security/configuration') - allow(controller).to receive(:action_name).and_return('show') - allow(view).to receive(:any_project_nav_tab?).and_return(true) - allow(view).to receive(:project_nav_tab?).and_return(true) - end - - it 'activates Security & Compliance tab' do - render - - expect(rendered).to have_css('li.active', text: 'Security & Compliance') - end - - it 'activates Configuration sub tab' do - render - - expect(rendered).to have_css('.sidebar-sub-level-items > li.active', text: 'Configuration') - end - end -end |