Sha256: 0384624e8fa8c81180122b51f210b2e535a2776f87e196b189532ac1b4ebcb4e

Contents?: true

Size: 1.02 KB

Versions: 22

Compression:

Stored size: 1.02 KB

Contents

RSpec.describe Licensee::Matchers::Package do
  let(:mit) { Licensee::License.find('mit') }
  let(:content) { '' }
  let(:file) do
    Licensee::ProjectFiles::LicenseFile.new(content, 'project.gemspec')
  end
  let(:license_property) { 'mit' }
  subject { described_class.new(file) }
  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 eql(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

22 entries across 22 versions & 1 rubygems

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