Sha256: f009e0d2d38f5825b362e66ff86b243ed9afdb2df9fe4b995a4f1f8c6484ec24

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

RSpec.describe Pluginscan::ErrorListPrinter do
  describe "error_lines", "showing ignores" do
    it 'marks lines as ignored where we think they are safe' do
      check_double = Struct.new(:name)
      check = check_double.new("Bad thing")
      check_findings = Pluginscan::CheckFindings.new(check)
      check_findings.add [Pluginscan::Finding.new(17, "  foo bar baz", "bar", true)]

      issues = Pluginscan::Issues.new(
        "./foo/bar.php" => [check_findings],
      )

      expect(Pluginscan::ErrorListPrinter.new.error_lines(issues)).to eq [
        %("./foo/bar.php", line 17, col 7: [Bad thing][IGNORE] foo bar baz),
      ]
    end
  end

  describe "error_lines", "hiding ignores" do
    it 'hide lines where we think they are safe' do
      check_double = Struct.new(:name)
      check = check_double.new("Bad thing")
      check_findings = Pluginscan::CheckFindings.new(check)
      check_findings.add [Pluginscan::Finding.new(17, "  foo bar baz", "bar", true)]

      issues = Pluginscan::Issues.new(
        "./foo/bar.php" => [check_findings],
      )

      expect(Pluginscan::ErrorListPrinter.new(true).error_lines(issues)).to be_empty
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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