Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/license_meta_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'license meta' do
licenses.each do |license|
# 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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tied license.id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. But you're commenting on the version before this PR. :)


context "The #{license['title']} license" do
it 'should only contain supported meta fields' do
Expand Down
6 changes: 3 additions & 3 deletions spec/license_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

licenses.each do |license|
context "The #{license['title']} license" do
let(:id) { license['id'] }
let(:spdx_lcase) { license['spdx-lcase'] }
let(:spdx_id) { license['spdx-id'] }

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(id).zero?)
expect(spdx_id.casecmp(spdx_lcase).zero?)
end

it 'uses its SPDX name' do
Expand All @@ -26,7 +26,7 @@

context 'industry approval' 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

Expand Down
8 changes: 2 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,12 @@ def config
def licenses
SpecHelper.licenses ||= begin
site.collections['licenses'].docs.map do |license|
id = File.basename(license.basename, '.txt')
license.to_liquid.merge('id' => id)
spdx_lcase = File.basename(license.basename, '.txt')
license.to_liquid.merge('spdx-lcase' => spdx_lcase)
end
end
end

def license_ids
licenses.map { |l| l['id'] }
end

def site
SpecHelper.site ||= begin
site = Jekyll::Site.new(config)
Expand Down