Commit 4c43ce1e authored by Olivier Gonzalez's avatar Olivier Gonzalez Committed by Robert Speicher

Remove condition on Security Dashboard quicklink

parent e672c821
...@@ -12,8 +12,7 @@ module EE ...@@ -12,8 +12,7 @@ module EE
def extra_statistics_anchors def extra_statistics_anchors
anchors = [] anchors = []
if can?(current_user, :read_project_security_dashboard, project) && if can?(current_user, :read_project_security_dashboard, project)
project.latest_pipeline_with_security_reports
anchors << security_dashboard_data anchors << security_dashboard_data
end end
......
...@@ -18,19 +18,14 @@ describe ProjectPresenter do ...@@ -18,19 +18,14 @@ describe ProjectPresenter do
link: project_security_dashboard_path(project)) link: project_security_dashboard_path(project))
end end
context 'user is allowed to read security dashboard' do
before do before do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(true) allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(true)
allow(project).to receive(:latest_pipeline_with_security_reports).and_return(pipeline)
end end
it 'has security dashboard link' do it 'has security dashboard link' do
expect(presenter.extra_statistics_anchors).to include(security_dashboard_data) expect(presenter.extra_statistics_anchors).to include(security_dashboard_data)
end end
shared_examples 'has no security dashboard link' do
it do
expect(presenter.extra_statistics_anchors).not_to include(security_dashboard_data)
end
end end
context 'user is not allowed to read security dashboard' do context 'user is not allowed to read security dashboard' do
...@@ -38,15 +33,9 @@ describe ProjectPresenter do ...@@ -38,15 +33,9 @@ describe ProjectPresenter do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(false) allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(false)
end end
it_behaves_like 'has no security dashboard link' it 'has no security dashboard link' do
end expect(presenter.extra_statistics_anchors).not_to include(security_dashboard_data)
context 'no pipeline having security reports' do
before do
allow(project).to receive(:latest_pipeline_with_security_reports).and_return(nil)
end end
it_behaves_like 'has no security dashboard link'
end end
end end
end end
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