mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
test required spdx-ids against data from spdx
This commit is contained in:
parent
28e4765dfe
commit
e5f46faa30
@ -8,13 +8,18 @@ describe 'licenses' do
|
||||
licenses.each do |license|
|
||||
context "The #{license['title']} license" do
|
||||
let(:id) { license['id'] }
|
||||
let(:spdx_id) { license['spdx-id'] }
|
||||
|
||||
it 'has an SPDX ID' do
|
||||
expect(spdx_ids).to include(id)
|
||||
expect(spdx_ids).to include(spdx_id)
|
||||
end
|
||||
|
||||
it 'has an ID that is downcased SPDX ID' do
|
||||
expect(spdx_id.casecmp(id).zero?)
|
||||
end
|
||||
|
||||
it 'uses its SPDX name' do
|
||||
spdx = find_spdx(id)
|
||||
spdx = find_spdx(spdx_id)
|
||||
expect(spdx).to_not be_nil
|
||||
expect(spdx[1]['name'].gsub(/ only$/, '')).to eql(license['title'])
|
||||
end
|
||||
|
@ -75,11 +75,11 @@ def spdx_list
|
||||
end
|
||||
|
||||
def spdx_ids
|
||||
spdx_list.map { |name, _properties| name.downcase }
|
||||
spdx_list.map { |name, _properties| name }
|
||||
end
|
||||
|
||||
def find_spdx(license)
|
||||
spdx_list.find { |name, _properties| name.casecmp(license).zero? }
|
||||
spdx_list.find { |name, _properties| name == license }
|
||||
end
|
||||
|
||||
def osi_approved_licenses
|
||||
|
Loading…
x
Reference in New Issue
Block a user