require 'spec_helper' RSpec.describe Pluginscan::Issues do def no_files_scanned Pluginscan::Issues.new({}) end def three_files_scanned_no_issues files_findings = { "a" => [], "b" => [], "c" => [], } Pluginscan::Issues.new(files_findings) end describe "scanned_files_count" do it "returns 0 when no files were scanned" do report = no_files_scanned expect(report.scanned_files_count).to eq 0 end it "returns 3 when 3 files were scanned" do report = three_files_scanned_no_issues expect(report.scanned_files_count).to eq 3 end end describe "found_problems_count" do it "returns 0 when no files were scanned" do report = no_files_scanned expect(report.found_problems_count).to eq 0 end it "returns 0 when no issues were found" do report = three_files_scanned_no_issues expect(report.found_problems_count).to eq 0 end it "returns 6 when 6 issues were found" do check_findings1 = double(count: 1) check_findings2 = double(count: 3) check_findings3 = double(count: 0) check_findings4 = double(count: 2) files_findings = { "a" => [check_findings1, check_findings2], "b" => [check_findings3], "c" => [check_findings4], } report = Pluginscan::Issues.new(files_findings) expect(report.found_problems_count).to eq 6 end end end