Sha256: 04c096bbb8c60f84d57acbfac489c9f6ebcba6fcfd75e63d7057502c82b18f0d

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 spec/pluginscan/issues_scanner/issues_spec.rb