Sha256: 13c9c5195ddd1afd336e5eed74e79479ae35e939ac016d2b1dc9ca3770793f36

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

module LicenseFinder
  describe MarkdownReport do
    describe '#to_s' do
      let(:dep1) do
        Dependency.new(
          'name' => 'gem_a',
          'version' => '1.0',
          'license' => License.find_by_name('other')
        )
      end

      let(:dep2) do
        dependency = Dependency.create(
          'name' => 'gem_b',
          'version' => '2.3',
          'license' => License.find_by_name('BSD')
        )
        dependency.approve!
        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"
        should match /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 other/
        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

5 entries across 5 versions & 1 rubygems

Version Path
license_finder-1.1.1-java spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-1.1.1 spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-1.1.0 spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-1.0.1 spec/lib/license_finder/reports/markdown_report_spec.rb
license_finder-1.0.0.1 spec/lib/license_finder/reports/markdown_report_spec.rb