Sha256: 09e2bd0998a282155992b099f145999a0f58a91d0022f62eb5d4c785a64dd222

Contents?: true

Size: 1.06 KB

Versions: 22

Compression:

Stored size: 1.06 KB

Contents

RSpec.describe Licensee::Matchers::DistZilla do
  let(:mit) { Licensee::License.find('mit') }
  let(:content) { 'license = MIT' }
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'dist.ini') }
  subject { described_class.new(file) }

  it 'stores the file' do
    expect(subject.file).to eql(file)
  end

  it 'has confidence' do
    expect(subject.confidence).to eql(90)
  end

  it 'matches' do
    expect(subject.match).to eql(mit)
  end

  {
    'spdx name'     => ['license = MIT', 'mit'],
    'non spdx name' => ['license = Mozilla_2_0', 'mpl-2.0'],
    'other license' => ['license = Foo', 'other']
  }.each do |description, license_declaration_and_key|
    context "with a #{description}" do
      let(:content) { license_declaration_and_key[0] }
      let(:license) { Licensee::License.find(license_declaration_and_key[1]) }

      it 'matches' do
        expect(subject.match).to eql(license)
      end
    end
  end

  context 'no license field' do
    let(:content) { 'foo = bar' }

    it 'returns nil' do
      expect(subject.match).to be_nil
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
licensee-9.11.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.10.1 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.10.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.4 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.3 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.2 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.1 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.0.beta.3 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.9.0.beta.2 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.8.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.7.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.6.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.5.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.4.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.3.1 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.3.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.2.1 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.2.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb
licensee-9.1.0 spec/licensee/matchers/dist_zilla_matcher_spec.rb