Commit d0b6d109 authored by scardoso's avatar scardoso

Address MR comments and fix rubocop issues

parent b33580f9
......@@ -23,7 +23,7 @@ module ProjectVulnerabilityFindingsActions
end
def summary
summary = Gitlab::Vulnerabilities::Summary.new(group, filter_params).vulnerabilities_counter
summary = Gitlab::Vulnerabilities::Summary.new(group, filter_params).findings_counter
respond_to do |format|
format.json do
......
......@@ -10,11 +10,10 @@ module Gitlab
@group = group
end
def vulnerabilities_counter
def findings_counter
return cached_vulnerability_summary if use_vulnerability_cache?
vulnerabilities = found_vulnerabilities.counted_by_severity
VulnerabilitySummarySerializer.new.represent(vulnerabilities)
end
......
......@@ -10,11 +10,11 @@ describe Gitlab::Vulnerabilities::Summary do
before do
create_vulnerabilities(1, project1, { severity: :medium, report_type: :sast })
create_vulnerabilities(2, project2, { severity: :high, report_type: :sast})
create_vulnerabilities(2, project2, { severity: :high, report_type: :sast })
end
describe '#vulnerabilities_counter', :use_clean_rails_memory_store_caching do
subject(:counter) { described_class.new(group, filters).vulnerabilities_counter }
describe '#findings_counter', :use_clean_rails_memory_store_caching do
subject(:counter) { described_class.new(group, filters).findings_counter }
context 'feature disabled' do
before do
......@@ -60,18 +60,6 @@ describe Gitlab::Vulnerabilities::Summary do
expect(counter[:high]).to eq(2)
end
end
context 'multiple projects with vulnerabilities' do
before do
Timecop.freeze(Date.today - 1) do
create_vulnerabilities(1, project1)
end
Timecop.freeze(Date.today - 4) do
create_vulnerabilities(1, project2)
end
end
end
end
def create_vulnerabilities(count, project, options = {})
......
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