Commit d0b6d109 authored by scardoso's avatar scardoso

Address MR comments and fix rubocop issues

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