Commit dece987d authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '207895-dismissed-findings-should-turn-in-to-dismissed-vulnerabilities' into 'master'

Match Vulnerability state to Vulnerabilites::Occurrence state

See merge request gitlab-org/gitlab!29049
parents 67e2ce26 a5eb25b5
......@@ -35,7 +35,7 @@ module Vulnerabilities
author: @author,
project: @project,
title: finding.name,
state: Vulnerability.states[:detected],
state: finding.state,
severity: finding.severity,
severity_overridden: false,
confidence: finding.confidence,
......
......@@ -26,7 +26,7 @@ describe Vulnerabilities::CreateService do
have_attributes(
author: user,
title: finding.name,
state: 'detected',
state: finding.state,
severity: finding.severity,
severity_overridden: false,
confidence: finding.confidence,
......@@ -35,6 +35,16 @@ describe Vulnerabilities::CreateService do
))
end
context 'and finding is dismissed' do
let(:finding) { create(:vulnerabilities_occurrence, :dismissed, project: project) }
it 'creates a vulnerability in a dismissed state' do
expect { subject }.to change { project.vulnerabilities.count }.by(1)
expect(project.vulnerabilities.last.state).to eq('dismissed')
end
end
it 'starts a new transaction for the create sequence' do
allow(Vulnerabilities::Occurrence).to receive(:transaction).and_call_original
......
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