mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 21:00:10 +01:00
Merge pull request #424 from github/non-mutable-id
make tests not overwrite non-mutable document 'id'
This commit is contained in:
commit
4ff8a2bec6
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||||||
describe 'license meta' do
|
describe 'license meta' do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
# Manually load the raw license so we don't get the defaults
|
# Manually load the raw license so we don't get the defaults
|
||||||
raw_fields = SafeYAML.load_file("_licenses/#{license['id']}.txt")
|
raw_fields = SafeYAML.load_file("_licenses/#{license['spdx-lcase']}.txt")
|
||||||
|
|
||||||
context "The #{license['title']} license" do
|
context "The #{license['title']} license" do
|
||||||
it 'should only contain supported meta fields' do
|
it 'should only contain supported meta fields' do
|
||||||
|
@ -7,7 +7,7 @@ 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(:spdx_lcase) { license['spdx-lcase'] }
|
||||||
let(:spdx_id) { license['spdx-id'] }
|
let(:spdx_id) { license['spdx-id'] }
|
||||||
|
|
||||||
it 'has an SPDX ID' do
|
it 'has an SPDX ID' do
|
||||||
@ -15,7 +15,7 @@ describe 'licenses' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'has an ID that is downcased SPDX ID' do
|
it 'has an ID that is downcased SPDX ID' do
|
||||||
expect(spdx_id.casecmp(id).zero?)
|
expect(spdx_id.casecmp(spdx_lcase).zero?)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'uses its SPDX name' do
|
it 'uses its SPDX name' do
|
||||||
@ -26,7 +26,7 @@ describe 'licenses' do
|
|||||||
|
|
||||||
context 'industry approval' do
|
context 'industry approval' do
|
||||||
it 'should be approved by OSI or FSF or OD' do
|
it 'should be approved by OSI or FSF or OD' do
|
||||||
expect(approved_licenses).to include(id), 'See https://git.io/vzCTV.'
|
expect(approved_licenses).to include(spdx_lcase), 'See https://git.io/vzCTV.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,16 +34,12 @@ end
|
|||||||
def licenses
|
def licenses
|
||||||
SpecHelper.licenses ||= begin
|
SpecHelper.licenses ||= begin
|
||||||
site.collections['licenses'].docs.map do |license|
|
site.collections['licenses'].docs.map do |license|
|
||||||
id = File.basename(license.basename, '.txt')
|
spdx_lcase = File.basename(license.basename, '.txt')
|
||||||
license.to_liquid.merge('id' => id)
|
license.to_liquid.merge('spdx-lcase' => spdx_lcase)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def license_ids
|
|
||||||
licenses.map { |l| l['id'] }
|
|
||||||
end
|
|
||||||
|
|
||||||
def site
|
def site
|
||||||
SpecHelper.site ||= begin
|
SpecHelper.site ||= begin
|
||||||
site = Jekyll::Site.new(config)
|
site = Jekyll::Site.new(config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user