1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-23 05:10:11 +01:00
choosealicense.com/spec/license_spec.rb

56 lines
1.5 KiB
Ruby
Raw Normal View History

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