Sha256: 66024909e6be521bec03510b9e1522990f6ad36607c487c7ac587cd3321864f3

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'helper'

class TestLicensee < Minitest::Test
  should "know the licenses" do
    assert_equal Array, Licensee.licenses.class
    assert_equal 15, Licensee.licenses.size
    assert_equal 20, Licensee.licenses(:hidden => true).size
    assert_equal Licensee::License, Licensee.licenses.first.class
  end

  should "detect a project's license" do
    assert_equal "mit", Licensee.license(fixture_path("licenses.git")).key
  end

  should "diff a license" do
    Licensee.diff(fixture_path("licenses.git"))
  end

  context "confidence threshold" do
    should "return the confidence threshold" do
      assert_equal 90, Licensee.confidence_threshold
    end

    should "let the user override the confidence threshold" do
      Licensee.confidence_threshold = 50
      assert_equal 50, Licensee.confidence_threshold
      Licensee.confidence_threshold = 90
    end
  end

  context "npm-bower matcher" do
    should "be disabled by default" do
      refute Licensee.matchers.include? Licensee::NpmBowerMatcher
    end

    should "be enable-able" do
      Licensee.package_manager_files = true
      assert Licensee.matchers.include? Licensee::NpmBowerMatcher
      Licensee.package_manager_files = false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
licensee-5.0.0b4 test/test_licensee.rb