Sha256: 716387e3b93265882305be63b3c75aa0b21f8c45890ec32063f71de55d4109f8

Contents?: true

Size: 954 Bytes

Versions: 3

Compression:

Stored size: 954 Bytes

Contents

require 'spec_helper'

module LicenseFinder
  describe CsvReport do
    it "accepts a custom list of columns" do
      dep = Package.new('gem_a', '1.0')
      subject = described_class.new([dep], columns: %w[name version])
      expect(subject.to_s).to eq("gem_a,1.0\n")
    end

    it "understands many columns" do
      dep = Package.new('gem_a', '1.0', description: "A description", summary: "A summary")
      dep.decide_on_license(License.find_by_name("MIT"))
      dep.decide_on_license(License.find_by_name("GPL"))
      dep.whitelisted!
      subject = described_class.new([dep], columns: %w[name version licenses approved summary description])
      expect(subject.to_s).to eq("gem_a,1.0,\"MIT,GPL\",Approved,A summary,A description\n")
    end

    it "ignores unknown columns" do
      dep = Package.new('gem_a', '1.0')
      subject = described_class.new([dep], columns: %w[unknown])
      expect(subject.to_s).to eq("\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
license_finder-2.0.1 spec/lib/license_finder/reports/csv_report_spec.rb
license_finder-2.0.0 spec/lib/license_finder/reports/csv_report_spec.rb
license_finder-2.0.0.rc2 spec/lib/license_finder/reports/csv_report_spec.rb