Sha256: 3bb8efb72174e5b0124cf2ddc1db155e6f9a5e24804f6512d3825951e969c0a4

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

RSpec.describe Licensee::Matchers::Package do
  subject { described_class.new(file) }

  let(:mit) { Licensee::License.find('mit') }
  let(:content) { '' }
  let(:file) do
    Licensee::ProjectFiles::LicenseFile.new(content, 'project.gemspec')
  end
  let(:license_property) { 'mit' }

  before do
    allow(subject).to receive(:license_property).and_return(license_property)
  end

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

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

  context 'with a nil license property' do
    let(:license_property) { nil }

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

  context 'with an empty license property' do
    let(:license_property) { '' }

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

  context 'with an unmatched license proprerty' do
    let(:license_property) { 'foo' }

    it 'matches to other' do
      expect(subject.match).to eql(Licensee::License.find('other'))
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
licensee-9.18.0 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.17.1 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.17.0 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.16.1 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.16.0 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.15.3 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.15.2 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.15.1 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.15.0 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.14.1 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.14.0 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.13.2 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.13.1 spec/licensee/matchers/package_matcher_spec.rb
licensee-9.13.0 spec/licensee/matchers/package_matcher_spec.rb