mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +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|
|
licenses.each do |license|
|
||||||
context "The #{license['title']} license" do
|
context "The #{license['title']} license" do
|
||||||
let(:id) { license['id'] }
|
let(:id) { license['id'] }
|
||||||
|
let(:spdx_id) { license['spdx-id'] }
|
||||||
|
|
||||||
it 'has an SPDX ID' do
|
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
|
end
|
||||||
|
|
||||||
it 'uses its SPDX name' do
|
it 'uses its SPDX name' do
|
||||||
spdx = find_spdx(id)
|
spdx = find_spdx(spdx_id)
|
||||||
expect(spdx).to_not be_nil
|
expect(spdx).to_not be_nil
|
||||||
expect(spdx[1]['name'].gsub(/ only$/, '')).to eql(license['title'])
|
expect(spdx[1]['name'].gsub(/ only$/, '')).to eql(license['title'])
|
||||||
end
|
end
|
||||||
|
@ -75,11 +75,11 @@ def spdx_list
|
|||||||
end
|
end
|
||||||
|
|
||||||
def spdx_ids
|
def spdx_ids
|
||||||
spdx_list.map { |name, _properties| name.downcase }
|
spdx_list.map { |name, _properties| name }
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_spdx(license)
|
def find_spdx(license)
|
||||||
spdx_list.find { |name, _properties| name.casecmp(license).zero? }
|
spdx_list.find { |name, _properties| name == license }
|
||||||
end
|
end
|
||||||
|
|
||||||
def osi_approved_licenses
|
def osi_approved_licenses
|
||||||
|
Loading…
x
Reference in New Issue
Block a user