Commit c229eee1 authored by Robert Speicher's avatar Robert Speicher

Merge branch...

Merge branch '250741-resolve-actionview-template-error-in-projects-security-vulnerabilitiescontroller-create_issue' into 'master'

Check if there are any remediations present for given Vulnerability

See merge request gitlab-org/gitlab!42627
parents cbf72932 65464692
......@@ -42,7 +42,7 @@
<% end %>
<% end %>
<% if vulnerability.remediations.present? %>
<% if vulnerability.remediations.present? && vulnerability.remediations.any? %>
### <%= _("Remediations") %>:
<% vulnerability.remediations.each do |remediation| %>
......
......@@ -32,6 +32,21 @@ RSpec.describe Issues::CreateFromVulnerabilityService, '#execute' do
context 'when a vulnerability exists' do
let(:result) { described_class.new(container: project, current_user: user, params: params).execute }
context 'when raw_metadata has no remediations' do
before do
finding = vulnerability.finding
metadata = Gitlab::Json.parse(finding.raw_metadata)
metadata["remediations"] = [nil]
finding.raw_metadata = metadata.to_json
finding.save!
end
it 'does not display Remediations section' do
expect(vulnerability.remediations).to eq([nil])
expect(result[:issue].description).not_to match(/Remediations/)
end
end
context 'when user does not have permission to create issue' do
before do
allow_next_instance_of(described_class) do |instance|
......
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