Sha256: ebedbf3e8c56e309bb2aec85937e56ff0aedf517991177434ba51054b33f3aba

Contents?: true

Size: 964 Bytes

Versions: 12

Compression:

Stored size: 964 Bytes

Contents

RSpec.describe Licensee::Matchers::Spdx do
  let(:content) { 'PackageLicenseDeclared: MIT' }
  let(:file) do
    Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.spdx')
  end
  let(:mit) { Licensee::License.find('mit') }
  let(:other) { Licensee::License.find('other') }
  subject { described_class.new(file) }

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

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

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

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

  context 'an unknown license' do
    let(:content) { 'PackageLicenseDeclared: xyz' }

    it 'returns other' do
      expect(subject.match).to eql(other)
    end
  end

  context 'a license expression' do
    let(:content) { 'PackageLicenseDeclared: (MIT OR Apache-2.0)' }

    it 'returns other' do
      expect(subject.match).to eql(other)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
licensee-9.11.0 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.10.1 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.10.0 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.4 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.3 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.2 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.1 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.0 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.0.beta.3 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.9.0.beta.2 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.8.0 spec/licensee/matchers/spdx_matcher_spec.rb
licensee-9.7.0 spec/licensee/matchers/spdx_matcher_spec.rb