Sha256: 125b2f8ff0ee82aab93fce69b0b4c1e7af8fd338c4450cf32257bab295c7753d
Contents?: true
Size: 1.33 KB
Versions: 13
Compression:
Stored size: 1.33 KB
Contents
RSpec.describe Licensee::Matchers::Reference do let(:content) { 'Copyright 2015 Ben Balter' } let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') } let(:license) { Licensee::License.find('gpl-3.0') } subject { described_class.new(file) } %i[title key nickname].each do |variation| context "with a license #{variation}" do let(:content) { "Licensed under the #{license.send(variation)} license" } it 'matches' do expect(subject.match).to eql(license) end context 'as a markdown link' do let(:content) { "[#{license.send(variation)}](https://example.com)" } it 'matches' do expect(subject.match).to eql(license) end end end end context 'a license key in a word' do let(:content) { 'My name is MITch!' } it "doesn't match" do expect(subject.match).to be_nil end end context 'a license with alt regex' do let(:content) { 'Clear BSD' } let(:license) { Licensee::License.find('bsd-3-clause-clear') } it 'matches' do expect(subject.match).to eql(license) end end context 'with a license source' do let(:license) { Licensee::License.find('mpl-2.0') } let(:content) { "The [license](#{license.source})" } it 'matches' do expect(subject.match).to eql(license) end end end
Version data entries
13 entries across 13 versions & 1 rubygems