Sha256: 305ad28c5417f06e7bb5daf80741da95c5c3b0a52ce03eaaf743a928bf00263a

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe Reporter do
    describe "#write_reports" do
      subject { Reporter.write_reports }

      before do
        allow(Dependency).to receive(:acknowledged) { [double(:dep)] }

        allow(MarkdownReport).to receive(:of) { 'markdown report' }
        allow(DetailedTextReport).to receive(:of) { 'detailed csv report' }
        allow(TextReport).to receive(:of) { 'csv report' }
        allow(HtmlReport).to receive(:of) { 'html report' }
      end

      it "writes an html file" do
        subject
        expect(LicenseFinder.config.artifacts.text_file.read).to eq("csv report\n")
        expect(LicenseFinder.config.artifacts.detailed_text_file.read).to eq("detailed csv report\n")
        expect(LicenseFinder.config.artifacts.markdown_file.read).to eq("markdown report\n")
        expect(LicenseFinder.config.artifacts.html_file.read).to eq("html report\n")
      end

      it "deletes old dependencies.txt file" do
        fake_file =  double(:fake_file, :exist? => true)
        allow(LicenseFinder.config.artifacts).to receive(:legacy_text_file) { fake_file }
        expect(fake_file).to receive(:delete)
        subject
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.2 spec/lib/license_finder/reports/reporter_spec.rb
license_finder-1.2-java spec/lib/license_finder/reports/reporter_spec.rb