Sha256: f1f3ad35f9e119dc66ff8e8ac5201596f87a07f87e3192a981ced3f6b8a41680

Contents?: true

Size: 903 Bytes

Versions: 11

Compression:

Stored size: 903 Bytes

Contents

RSpec.describe Licensee::Matchers::NpmBower do
  let(:content) { '"license": "mit"' }
  let(:file) { Licensee::Project::LicenseFile.new(content, 'LICENSE.txt') }
  let(:mit) { Licensee::License.find('mit') }
  let(:no_license) { Licensee::License.find('no-license') }
  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

  {
    'double quotes' => '"license": "mit"',
    'single quotes' => "'license': 'mit'",
    'mixed quotes'  => "'license': \"mit\"",
    'whitespace'    => "'license' : 'mit'",
    'no whitespace' => "'license':'mit'"
  }.each do |description, license_declaration|
    context "with a #{description} declaration" do
      let(:content) { license_declaration }

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
licensee-8.9.2 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.9.0 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.5 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.4 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.3 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.2 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.1 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.8.0 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.7.0 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.6.1 spec/licensee/matchers/npm_bower_matcher_spec.rb
licensee-8.6.0 spec/licensee/matchers/npm_bower_matcher_spec.rb