Commit 73005a2c authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Delegate Finding#scan_type to Scan

parent bf7bf2c3
......@@ -88,7 +88,7 @@ module Security
end
def loaded_report_types
security_findings.map(&:scan).flat_map(&:scan_type).uniq
security_findings.map(&:scan_type).uniq
end
def loaded_project_fingerprints
......
......@@ -38,5 +38,7 @@ module Security
scope :with_scan, -> { includes(:scan) }
scope :with_scanner, -> { includes(:scanner) }
scope :deduplicated, -> { where(deduplicated: true) }
delegate :scan_type, to: :scan, allow_nil: true
end
end
......@@ -15,6 +15,10 @@ RSpec.describe Security::Finding do
it { is_expected.to validate_length_of(:project_fingerprint).is_at_most(40) }
end
describe 'delegations' do
it { is_expected.to delegate_method(:scan_type).to(:scan).allow_nil }
end
describe '.by_position' do
let!(:finding_1) { create(:security_finding, position: 0) }
let!(:finding_2) { create(:security_finding, position: 1) }
......
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