RSpec.describe Pluginscan::FileScanner do describe "#scan" do subject(:scanner) { Pluginscan::FileScanner.new(double) } let(:results) { scanner.scan(file_contents) } context 'with a file which is invalid utf-8' do let(:file_contents) { "\xc2" } it "finds one result" do expect(results.count).to eq 1 end it "finds a result of invalid UTF-8" do expect(results.first.check.name).to eq 'Encoding' expect(results.first.check.message).to eq 'invalid UTF-8' end it "finds a result with no findings" do expect(results.first.findings).to eq [] end end end end