Sha256: 90182e44261f32fe944dd88f62ae48f4730906c9f1b4bd89a75df304c5bcc6c0

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

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', authors: "the authors", description: "A description", summary: "A summary", homepage: "http://homepage.example.com")
      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 authors licenses approved summary description homepage])
      expect(subject.to_s).to eq("gem_a,1.0,the authors,\"MIT,GPL\",Approved,A summary,A description,http://homepage.example.com\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

    it 'supports install_path column' do
      dep = Package.new('gem_a', '1.0', install_path: '/tmp/gems/gem_a-1.0')
      subject = described_class.new([dep], columns: %w[name version install_path])
      expect(subject.to_s).to eq("gem_a,1.0,/tmp/gems/gem_a-1.0\n")
    end

    it "does not include columns that should only be in merged reports" do
      dep = Package.new('gem_a', '1.0')
      subject = described_class.new([dep], columns: %w[subproject_paths])
      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.1.0.rc4 spec/lib/license_finder/reports/csv_report_spec.rb
license_finder-2.1.0.rc3 spec/lib/license_finder/reports/csv_report_spec.rb
license_finder-2.1.0.rc2 spec/lib/license_finder/reports/csv_report_spec.rb