Skip to content

Commit

Permalink
test required spdx-ids against data from spdx
Browse files Browse the repository at this point in the history
  • Loading branch information
mlinksva committed May 25, 2016
1 parent 28e4765 commit e5f46fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions spec/license_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
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
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e5f46fa

Please sign in to comment.