spec/licensee/matchers/cran_matcher_spec.rb in licensee-8.9.2 vs spec/licensee/matchers/cran_matcher_spec.rb in licensee-9.0.0.beta.1
- old
+ new
@@ -1,11 +1,11 @@
RSpec.describe Licensee::Matchers::Cran do
let(:mit) { Licensee::License.find('mit') }
let(:gpl2) { Licensee::License.find('gpl-2.0') }
let(:gpl3) { Licensee::License.find('gpl-3.0') }
let(:content) { "License: MIT + file LICENSE\nPackage: test" }
- let(:file) { Licensee::Project::LicenseFile.new(content, 'DESCRIPTION') }
+ let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'DESCRIPTION') }
subject { described_class.new(file) }
it 'stores the file' do
expect(subject.file).to eql(file)
end
@@ -24,16 +24,25 @@
'GPL (>=2)' => Licensee::License.find('gpl-2.0'),
'GPL( >= 2 )' => Licensee::License.find('gpl-2.0'),
'GPL (>=2) + file LICENSE' => Licensee::License.find('gpl-2.0'),
'GPL (>=3)' => Licensee::License.find('gpl-3.0'),
'GPL-2' => Licensee::License.find('gpl-2.0'),
- 'GPL-3' => Licensee::License.find('gpl-3.0')
+ 'GPL-3' => Licensee::License.find('gpl-3.0'),
+ 'Foo' => Licensee::License.find('other')
}.each do |license_declaration, license|
context "with '#{license_declaration}' declaration" do
let(:content) { "Package: test\nLicense: #{license_declaration}" }
it 'matches' do
expect(subject.match).to eql(license)
end
+ end
+ end
+
+ context 'with no license field' do
+ let(:content) { 'Package: test' }
+
+ it 'returns nil' do
+ expect(subject.match).to be_nil
end
end
end