Commit 3034b13e authored by Jonathan Schafer's avatar Jonathan Schafer

Rename OccurenceSerializer to FindingSerializer

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