Sha256: d971942f207a686fb38a73ee63d53744f60bbe5f5322ae32a7e2d64e3ca89bb3

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 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('whitelist' => ['MIT', 'other']) }

      before do
        LicenseFinder.stub(:config).and_return config
      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

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 spec/lib/license_finder/tables/license_alias_spec.rb
license_finder-1.0.0.0-java spec/lib/license_finder/tables/license_alias_spec.rb