1
0
mirror of https://github.com/github/choosealicense.com synced 2024-11-05 19:28:50 +01:00
choosealicense.com/spec/license_spec.rb

37 lines
1023 B
Ruby
Raw Normal View History

2015-03-07 18:47:24 +01:00
require 'spec_helper'
2015-08-22 18:41:30 +02:00
# List of licenses that need not be OSI approved
LICENSE_WHITELIST = %w[
unlicense
cc0-1.0
wtfpl
2015-08-22 22:41:42 +02:00
bsd-3-clause-clear
2015-08-22 18:41:30 +02:00
]
2015-03-07 18:47:24 +01:00
licenses.each do |license|
describe "The #{license["title"]} license" do
2015-03-07 19:38:52 +01:00
describe "SPDX compliance" do
# "No license" isn't really a license, so no need to test
unless license["id"] == "no-license"
it "#{license["id"]} should be a valid SPDX ID" do
expect(find_spdx(license["id"])).to_not be_nil
end
it "should be the proper SPDX name" do
spdx = find_spdx(license["id"])
expect(spdx[1]["name"].gsub(/ only$/,"")).to eql(license["title"])
end
# CC0 and Unlicense are not OSI approved, but that's okay
2015-08-22 18:41:30 +02:00
unless LICENSE_WHITELIST.include? license["id"]
2015-03-07 19:38:52 +01:00
it "should be OSI approved" do
spdx = find_spdx(license["id"])
2015-08-22 18:41:30 +02:00
approved = spdx[1]["osiApproved"]
expect(approved).to eql(true)
2015-03-07 19:38:52 +01:00
end
end
end
end
2015-03-07 18:47:24 +01:00
end
end