1
0
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:
Mike Linksvayer 2016-05-25 08:53:23 -05:00
parent 28e4765dfe
commit e5f46faa30
2 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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