Sha256: 4d5f405c7627d7f8421d8b289c98c7fd126c5bc1a9b20fb43f7bd56101e45fce
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require 'acceptance_spec_helper' require 'support/heredoc_helper' RSpec.describe Pluginscan::Scanner do before do # these are slow, so don't run them if we don't have to stub_cloc stub_sloccount stub_vuln_check end describe '.scan' do let(:output) { StringIO.new } describe "CLOC Report", type: [:file, :process] do subject(:scanner) { Pluginscan::Scanner.new(sloccount: false, output: output) } before(:all) { setup_tempdir 'tmp' } it "reports on sloc by language" do LanguageCount = Struct.new :language, :sloc, :file_count cloc_output = <<-EOS.heredoc_unindent files,language,blank,comment,code,"github.com/AlDanial/cloc v 1.70 T=0.29 s (284.9 files/s, 65539.8 lines/s)" 20,PHP,4584,0,6628 EOS stub_cloc(result: cloc_output) php = coloured_cyan('PHP') count = coloured_red('6628') scanner.scan 'tmp' expect(output.string).to match(/#{php}\s*#{count} lines across 20 files/) end it "displays a message when there was no code" do stub_cloc(result: "") scanner.scan 'tmp' expect(output.string).to match(/CLOC didn't find any code/) end it "displays a message when cloc was unavailable (doesn't error out)" do stub_cloc(which_result: which_failure) scanner.scan 'tmp' expect(output.string).to match(/The 'cloc' command is unavailable/) end it "displays a message when cloc threw an error (doesn't error out)" do stub_cloc(result: "Some nonsense", process_status: failed_process_status) scanner.scan 'tmp' expect(output.string).to match(/Some nonsense/) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pluginscan-0.9.0 | spec/acceptance/cloc_spec.rb |