2015-03-07 18:47:24 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-02-08 21:37:19 +01:00
|
|
|
describe 'licenses' do
|
|
|
|
it 'matches the number of files in the _licenses folder' do
|
2016-02-09 18:21:11 +01:00
|
|
|
expect(licenses.count).to eql(Dir["#{licenses_path}/*.txt"].count)
|
2016-01-29 18:44:28 +01:00
|
|
|
end
|
|
|
|
|
2016-01-20 16:20:04 +01:00
|
|
|
licenses.each do |license|
|
2016-02-08 21:37:19 +01:00
|
|
|
context "The #{license['title']} license" do
|
2016-06-01 17:36:56 +02:00
|
|
|
let(:spdx_lcase) { license['spdx-lcase'] }
|
2016-05-25 15:53:23 +02:00
|
|
|
let(:spdx_id) { license['spdx-id'] }
|
2016-01-15 23:40:32 +01:00
|
|
|
|
2016-02-08 21:37:19 +01:00
|
|
|
it 'has an SPDX ID' do
|
2016-05-25 15:53:23 +02:00
|
|
|
expect(spdx_ids).to include(spdx_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has an ID that is downcased SPDX ID' do
|
2016-06-01 17:36:56 +02:00
|
|
|
expect(spdx_id.casecmp(spdx_lcase).zero?)
|
2016-01-20 16:20:04 +01:00
|
|
|
end
|
2016-01-15 23:40:32 +01:00
|
|
|
|
2016-02-08 21:37:19 +01:00
|
|
|
it 'uses its SPDX name' do
|
2016-05-25 15:53:23 +02:00
|
|
|
spdx = find_spdx(spdx_id)
|
2016-01-20 16:42:36 +01:00
|
|
|
expect(spdx).to_not be_nil
|
2016-02-08 21:37:19 +01:00
|
|
|
expect(spdx[1]['name'].gsub(/ only$/, '')).to eql(license['title'])
|
2016-01-20 16:20:04 +01:00
|
|
|
end
|
2016-01-15 23:40:32 +01:00
|
|
|
|
2016-02-08 21:37:19 +01:00
|
|
|
context 'industry approval' do
|
|
|
|
it 'should be approved by OSI or FSF or OD' do
|
2016-06-01 17:36:56 +02:00
|
|
|
expect(approved_licenses).to include(spdx_lcase), 'See https://git.io/vzCTV.'
|
2016-01-20 16:20:04 +01:00
|
|
|
end
|
|
|
|
end
|
2016-01-15 23:40:32 +01:00
|
|
|
|
2016-02-09 18:26:24 +01:00
|
|
|
context 'minimum permissions' do
|
2016-03-01 22:33:15 +01:00
|
|
|
let(:permissions) { license['permissions'] }
|
2016-02-09 18:26:24 +01:00
|
|
|
it 'should allow commercial use' do
|
|
|
|
expect(permissions).to include('commercial-use')
|
2016-02-08 19:25:06 +01:00
|
|
|
end
|
2016-02-08 23:02:07 +01:00
|
|
|
|
2016-02-09 18:26:24 +01:00
|
|
|
it 'should allow modification' do
|
|
|
|
expect(permissions).to include('modifications')
|
2016-02-08 19:25:06 +01:00
|
|
|
end
|
2016-02-08 23:02:07 +01:00
|
|
|
|
2016-02-09 18:26:24 +01:00
|
|
|
it 'should allow distribution' do
|
|
|
|
expect(permissions).to include('distribution')
|
2016-02-08 19:25:06 +01:00
|
|
|
end
|
2016-02-08 23:02:07 +01:00
|
|
|
|
2016-02-09 18:26:24 +01:00
|
|
|
it 'should allow private use' do
|
|
|
|
expect(permissions).to include('private-use')
|
2016-01-20 16:20:04 +01:00
|
|
|
end
|
2016-01-16 00:01:07 +01:00
|
|
|
end
|
2015-03-07 19:38:52 +01:00
|
|
|
end
|
2015-03-07 18:47:24 +01:00
|
|
|
end
|
|
|
|
end
|