Commit 9306f33f authored by Dylan Griffith's avatar Dylan Griffith

Merge branch...

Merge branch '214567-rename-vulnerabilities-occurrenceserializer-to-vulnerabilities-findingserializer' into 'master'

Rename Vulnerabilities::OccurrenceSerializer to FindingSerializer

See merge request gitlab-org/gitlab!31957
parents d2971491 3034b13e
...@@ -16,7 +16,7 @@ module ProjectVulnerabilityFindingsActions ...@@ -16,7 +16,7 @@ module ProjectVulnerabilityFindingsActions
respond_to do |format| respond_to do |format|
format.json do format.json do
render json: Vulnerabilities::OccurrenceSerializer render json: Vulnerabilities::FindingSerializer
.new(current_user: current_user) .new(current_user: current_user)
.with_pagination(request, response) .with_pagination(request, response)
.represent(ordered_findings, preload: true) .represent(ordered_findings, preload: true)
......
...@@ -31,10 +31,10 @@ module VulnerabilitiesHelper ...@@ -31,10 +31,10 @@ module VulnerabilitiesHelper
end end
def vulnerability_finding_data(finding) def vulnerability_finding_data(finding)
occurrence = Vulnerabilities::OccurrenceSerializer.new(current_user: current_user).represent(finding) finding = Vulnerabilities::FindingSerializer.new(current_user: current_user).represent(finding)
remediation = occurrence[:remediations]&.first remediation = finding[:remediations]&.first
occurrence.slice( finding.slice(
:description, :description,
:identifiers, :identifiers,
:links, :links,
...@@ -45,7 +45,7 @@ module VulnerabilitiesHelper ...@@ -45,7 +45,7 @@ module VulnerabilitiesHelper
:project, :project,
:remediations :remediations
).merge( ).merge(
solution: remediation ? remediation['summary'] : occurrence[:solution] solution: remediation ? remediation['summary'] : finding[:solution]
) )
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class Vulnerabilities::OccurrenceSerializer < BaseSerializer class Vulnerabilities::FindingSerializer < BaseSerializer
include WithPagination include WithPagination
entity Vulnerabilities::FindingEntity entity Vulnerabilities::FindingEntity
......
...@@ -22,7 +22,7 @@ describe VulnerabilitiesHelper do ...@@ -22,7 +22,7 @@ describe VulnerabilitiesHelper do
:confirmed_by_id :confirmed_by_id
) )
end end
let(:occurrence_serializer_hash) do let(:finding_serializer_hash) do
finding.slice(:description, finding.slice(:description,
:identifiers, :identifiers,
:links, :links,
...@@ -46,9 +46,9 @@ describe VulnerabilitiesHelper do ...@@ -46,9 +46,9 @@ describe VulnerabilitiesHelper do
expect(VulnerabilitySerializer).to receive(:new).and_return(vulnerability_serializer_stub) expect(VulnerabilitySerializer).to receive(:new).and_return(vulnerability_serializer_stub)
expect(vulnerability_serializer_stub).to receive(:represent).with(vulnerability).and_return(vulnerability_serializer_hash) expect(vulnerability_serializer_stub).to receive(:represent).with(vulnerability).and_return(vulnerability_serializer_hash)
occurrence_serializer_stub = instance_double("Vulnerabilities::OccurrenceSerializer") finding_serializer_stub = instance_double("Vulnerabilities::FindingSerializer")
expect(Vulnerabilities::OccurrenceSerializer).to receive(:new).and_return(occurrence_serializer_stub) expect(Vulnerabilities::FindingSerializer).to receive(:new).and_return(finding_serializer_stub)
expect(occurrence_serializer_stub).to receive(:represent).with(finding).and_return(occurrence_serializer_hash) expect(finding_serializer_stub).to receive(:represent).with(finding).and_return(finding_serializer_hash)
end end
around do |example| around do |example|
......
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