Sha256: 20bb3b05ad88b67e57198479b8259cd02b4b060145e8dacceb23eee781f73660

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

module LicenseFinder
  describe MarkdownReport do
    describe '#to_s' do
      let(:dep1) do
        dependency = Dependency.new(
          'name' => 'gem_a',
          'version' => '1.0',
          'manually_approved' => false
        )
        dependency.license = LicenseFinder::LicenseAlias.create(name: 'MIT')
        dependency
      end

      let(:dep2) do
        dependency = Dependency.new(
          'name' => 'gem_b',
          'version' => '2.3',
          'manually_approved' => true
        )
        dependency.license = LicenseFinder::LicenseAlias.create(name: 'BSD')
        dependency
      end

      subject { MarkdownReport.new([dep2, dep1]).to_s }

      it 'should have the correct header' do
        LicenseFinder.config.project_name = "new_project_name"
        should match "# new_project_name"
      end

      it 'should list the total, and unapproved counts' do
        should match "2 total, _1 unapproved_"
      end

      it "should list the unapproved dependency" do
        should match "href='#gem_a'"
      end

      it "should display a summary" do
        should match "## Summary"
        should match /\s+\* 1 MIT/
        should match /\s+\* 1 BSD/
      end

      it "should list both gems" do
        should match "## Items"
        should match "### gem_a v1.0"
        should match "### gem_b v2.3"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-1.0.0.0-java spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-0.9.5.1-java spec/lib/license_finder/markdown_report_spec.rb
license_finder-0.9.5.1 spec/lib/license_finder/markdown_report_spec.rb
license_finder-0.9.5 spec/lib/license_finder/markdown_report_spec.rb
license_finder-0.9.5-java spec/lib/license_finder/markdown_report_spec.rb