Commit 6bc0aa30 authored by Robert Speicher's avatar Robert Speicher

Merge branch '7201_remove_condition_on_security_dasbhoard_quick_link' into 'master'

Remove condition on Security Dashboard quicklink

See merge request gitlab-org/gitlab-ee!7472
parents e672c821 4c43ce1e
Pipeline #31822805 passed with stages
in 47 minutes and 53 seconds
......@@ -12,8 +12,7 @@ module EE
def extra_statistics_anchors
anchors = []
if can?(current_user, :read_project_security_dashboard, project) &&
project.latest_pipeline_with_security_reports
if can?(current_user, :read_project_security_dashboard, project)
anchors << security_dashboard_data
end
......
......@@ -18,18 +18,13 @@ describe ProjectPresenter do
link: project_security_dashboard_path(project))
end
before do
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
it 'has security dashboard link' do
expect(presenter.extra_statistics_anchors).to include(security_dashboard_data)
end
context 'user is allowed to read security dashboard' do
before do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(true)
end
shared_examples 'has no security dashboard link' do
it do
expect(presenter.extra_statistics_anchors).not_to include(security_dashboard_data)
it 'has security dashboard link' do
expect(presenter.extra_statistics_anchors).to include(security_dashboard_data)
end
end
......@@ -38,15 +33,9 @@ describe ProjectPresenter do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(false)
end
it_behaves_like 'has no security dashboard link'
end
context 'no pipeline having security reports' do
before do
allow(project).to receive(:latest_pipeline_with_security_reports).and_return(nil)
it 'has no security dashboard link' do
expect(presenter.extra_statistics_anchors).not_to include(security_dashboard_data)
end
it_behaves_like 'has no security dashboard link'
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