Sha256: 0a83c4a9517cd50409248ec155ba3fd6a2a181f7eb8f0cb6df61fe8c84710279

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe LicenseAlias do
    describe 'initializes' do
      it "delegates to LicenseUrl.find_by_name for the url" do
        LicenseUrl.stub(:find_by_name).with("MIT").and_return "http://license-url.com"
        license = described_class.new(name: 'MIT')
        license.url.should == "http://license-url.com"
      end
    end

    describe "#whitelisted?" do
      let(:config) { Configuration.new }

      before do
        LicenseFinder.stub(:config).and_return config
        config.whitelist = ["MIT", "other"]
      end

      it "should return true when the license is whitelisted" do
        described_class.new(name: 'MIT').should be_whitelisted
      end

      it "should return true when the license is an alternative name of a whitelisted license" do
        described_class.new(name: 'Expat').should be_whitelisted
      end

      it "should return true when the license has no matching license class, but is whitelisted anyways" do
        described_class.new(name: 'other').should be_whitelisted
      end

      it "should return false when the license is not whitelisted" do
        described_class.new(name: 'GPL').should_not be_whitelisted
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
license_finder-0.9.5.1-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.5.1 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.5 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.5-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.4-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.4 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.3-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.3 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.2-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.2 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.1-java spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-0.9.1 spec/lib/license_finder/tables/license_alias_spec.rb