spec/licensee/matchers/gemspec_matcher_spec.rb in licensee-8.9.2 vs spec/licensee/matchers/gemspec_matcher_spec.rb in licensee-9.0.0.beta.1

- old
+ new

@@ -1,9 +1,11 @@ RSpec.describe Licensee::Matchers::Gemspec do let(:mit) { Licensee::License.find('mit') } let(:content) { "s.license = 'mit'" } - let(:file) { Licensee::Project::LicenseFile.new(content, 'project.gemspec') } + let(:file) do + Licensee::ProjectFiles::LicenseFile.new(content, 'project.gemspec') + end subject { described_class.new(file) } it 'matches' do expect(subject.match).to eql(mit) end @@ -22,8 +24,24 @@ let(:content) { license_declaration } it 'matches' do expect(subject.match).to eql(mit) end + end + end + + context 'no license field' do + let(:content) { "s.foo = 'bar'" } + + it 'returns nil' do + expect(subject.match).to be_nil + end + end + + context 'an unknown license' do + let(:content) { "s.license = 'foo'" } + + it 'returns other' do + expect(subject.match).to eql(Licensee::License.find('other')) end end end