Sha256: 9221c43380eb771e1a84fccf1c66a19b1a6f18d4dbd33bf31cf9a488e4af2159

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 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'
        )
        dependency.license = LicenseFinder::LicenseAlias.create(name: 'MIT')
        dependency.approval = Approval.create(state: false)
        dependency
      end

      let(:dep2) do
        dependency = Dependency.new(
          'name' => 'gem_b',
          'version' => '2.3'
        )
        dependency.license = LicenseFinder::LicenseAlias.create(name: 'BSD')
        dependency.approval = Approval.create(state: true)
        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

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-0.9.4-java spec/lib/license_finder/markdown_report_spec.rb
license_finder-0.9.4 spec/lib/license_finder/markdown_report_spec.rb