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