mirror of https://github.com/licensee/licensee.git
no attribution from instance license file if matching license file not templated
This commit is contained in:
parent
f4272076c7
commit
6f763d0965
|
@ -54,6 +54,7 @@ module Licensee
|
|||
|
||||
def attribution
|
||||
@attribution ||= begin
|
||||
return unless license.content =~ /\[fullname\]/
|
||||
matches = Matchers::Copyright::REGEX
|
||||
.match(content_without_title_and_version)
|
||||
matches[0] if matches
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
RSpec.describe Licensee::ProjectFiles::LicenseFile do
|
||||
let(:filename) { 'LICENSE.txt' }
|
||||
let(:gpl) { Licensee::License.find('gpl-3.0') }
|
||||
let(:mit) { Licensee::License.find('mit') }
|
||||
let(:content) { sub_copyright_info(mit) }
|
||||
let(:content_hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' }
|
||||
|
@ -26,6 +27,14 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a non-templated license' do
|
||||
let(:content) { sub_copyright_info(gpl) }
|
||||
|
||||
it "doesn't match" do
|
||||
expect(subject.attribution).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it 'creates the wordset' do
|
||||
expect(subject.wordset.count).to eql(91)
|
||||
expect(subject.wordset.first).to eql('permission')
|
||||
|
@ -215,7 +224,6 @@ Creative Commons Attribution-NonCommercial 4.0
|
|||
end
|
||||
|
||||
context 'GPL' do
|
||||
let(:gpl) { Licensee::License.find('gpl-3.0') }
|
||||
let(:content) { sub_copyright_info(gpl) }
|
||||
|
||||
it 'knows its GPL' do
|
||||
|
|
Loading…
Reference in New Issue