Commit 884680f3 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch...

Merge branch '36017-move-analytics-out-of-more-in-top-navbar-and-merge-with-instance-statistics' into 'master'

Ensure that instance statistics links are only displayed if a user has access to the features

See merge request gitlab-org/gitlab!22476
parents edcdbaec c6b01f93
- return unless dashboard_nav_link?(:analytics)
- return unless can?(current_user, :read_instance_statistics)
= nav_link(controller: :dev_ops_score) do
= link_to instance_statistics_dev_ops_score_index_path do
.nav-icon-container
......
......@@ -40,6 +40,10 @@ describe 'layouts/nav/sidebar/_analytics' do
end
context 'and user has access to instance statistics features' do
before do
allow(view).to receive(:can?) { true }
end
it 'has `DevOps Score` link' do
render
......@@ -58,9 +62,11 @@ describe 'layouts/nav/sidebar/_analytics' do
end
context 'and user does not have access to instance statistics features' do
it 'no instance statistics links are rendered' do
allow(view).to receive(:dashboard_nav_link?).and_return(false)
before do
allow(view).to receive(:can?) { false }
end
it 'no instance statistics links are rendered' do
render
expect(rendered).not_to have_content('DevOps Score')
......@@ -78,6 +84,10 @@ describe 'layouts/nav/sidebar/_analytics' do
end
context 'and user has access to instance statistics features' do
before do
allow(view).to receive(:can?) { true }
end
it 'has `DevOps Score` link' do
render
......@@ -96,9 +106,11 @@ describe 'layouts/nav/sidebar/_analytics' do
end
context 'and user does not have access to instance statistics features' do
it 'no instance statistics links are rendered' do
allow(view).to receive(:dashboard_nav_link?).and_return(false)
before do
allow(view).to receive(:can?) { false }
end
it 'no instance statistics links are rendered' do
render
expect(rendered).not_to have_content('DevOps Score')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment