Skip to content

Commit 3ae4986

Browse files
committed
[Fixed] Fix CPL1 pretty name
Previously, this licenses was used in tests but not explicitly detected from a License definition. Introducing detection for this license should not have caused any changes, but after the change, the "pretty name" did not match what previously appeared.
1 parent b3dde46 commit 3ae4986

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

lib/license_finder/license/definitions.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,15 @@ def cpl1
173173
License.new(
174174
short_name: 'CPL1',
175175
spdx_id: 'CPL-1.0',
176-
pretty_name: 'Common Public License 1.0',
176+
pretty_name: 'Common Public License Version 1.0',
177177
other_names: [
178178
'CPL-1',
179179
'CPL 1',
180180
'CPL-1.0',
181181
'CPL 1.0',
182-
'Common Public License, v1.0',
183-
'COMMON PUBLIC LICENSE VERSION 1.0'
182+
'Common Public License 1.0',
183+
'Common Public License v1.0',
184+
'Common Public License, v1.0'
184185
],
185186
url: 'https://opensource.org/licenses/cpl1.0.txt'
186187
)

spec/lib/license_finder/license/definitions_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,33 @@
191191
end
192192
end
193193

194+
describe LicenseFinder::License, 'CPL1' do
195+
subject { described_class.find_by_name 'CPL1' }
196+
197+
it 'should have correct license url' do
198+
expect(subject.url).to be 'https://opensource.org/licenses/cpl1.0.txt'
199+
end
200+
201+
it 'should be recognized by spdx_id' do
202+
expect(described_class.find_by_name('CPL-1.0')).to be subject
203+
end
204+
205+
it 'should be recognized by pretty name' do
206+
expect(described_class.find_by_name('Common Public License Version 1.0')).to be subject
207+
end
208+
209+
it 'should be recognised by other names' do
210+
expect(described_class.find_by_name('CPL-1')).to be subject
211+
expect(described_class.find_by_name('CPL 1')).to be subject
212+
expect(described_class.find_by_name('CPL-1.0')).to be subject
213+
expect(described_class.find_by_name('CPL 1.0')).to be subject
214+
expect(described_class.find_by_name('Common Public License 1.0')).to be subject
215+
expect(described_class.find_by_name('Common Public License v1.0')).to be subject
216+
expect(described_class.find_by_name('Common Public License, v1.0')).to be subject
217+
expect(described_class.find_by_name('COMMON PUBLIC LICENSE VERSION 1.0')).to be subject
218+
end
219+
end
220+
194221
describe LicenseFinder::License, 'EPL1' do
195222
subject { described_class.find_by_name 'EPL1' }
196223

0 commit comments

Comments
 (0)