Commit 3c7559aa authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch 'fix_as_json_usage' into 'master'

Fix Vulnerabilities::Finding#remediations method

See merge request gitlab-org/gitlab!50317
parents d06e9696 48388541
......@@ -241,7 +241,7 @@ module Vulnerabilities
def remediations
return metadata.dig('remediations') unless super.present?
super.as_json(only: [:summary, :diff])
super.as_json(only: [:summary], methods: [:diff])
end
def build_evidence_request(data)
......
......@@ -461,7 +461,7 @@ RSpec.describe Vulnerabilities::Finding do
context 'when the finding has associated remediation records' do
let!(:persisted_remediation) { create(:vulnerabilities_remediation, findings: [finding]) }
let(:remediation_hash) { persisted_remediation.as_json(only: [:summary, :diff]) }
let(:remediation_hash) { { 'summary' => persisted_remediation.summary, 'diff' => persisted_remediation.diff } }
it { is_expected.to eq([remediation_hash]) }
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