mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
better error output
This commit is contained in:
parent
b7204165de
commit
5531742d10
@ -1,7 +1,8 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "license categories" do
|
||||||
families.each do |family|
|
families.each do |family|
|
||||||
describe "the #{family} family" do
|
context "the #{family} family" do
|
||||||
family_licenses = licenses.select { |l| l["family"] == family }
|
family_licenses = licenses.select { |l| l["family"] == family }
|
||||||
primary = family_licenses.select { |l| l["variant"] == false }
|
primary = family_licenses.select { |l| l["variant"] == false }
|
||||||
variants = family_licenses.select { |l| l["variant"] == true }
|
variants = family_licenses.select { |l| l["variant"] == true }
|
||||||
@ -16,7 +17,7 @@ families.each do |family|
|
|||||||
end
|
end
|
||||||
|
|
||||||
family_licenses.each do |license|
|
family_licenses.each do |license|
|
||||||
describe "the #{license["title"]} license" do
|
context "the #{license["title"]} license" do
|
||||||
it "should have a unique slug" do
|
it "should have a unique slug" do
|
||||||
dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
|
dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
|
||||||
expect(dupes).to eql(1)
|
expect(dupes).to eql(1)
|
||||||
@ -29,3 +30,4 @@ families.each do |family|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "license fillable fields" do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
describe "The #{license["title"]} license" do
|
context "The #{license["title"]} license" do
|
||||||
it "should only contain supported fields" do
|
it "should only contain supported fillable fields" do
|
||||||
matches = license["content"].scan /\[([a-z]+)\]/
|
matches = license["content"].scan(/\[([a-z]+)\]/)
|
||||||
extra_fields = matches.flatten - fields.map { |f| f["name"] }
|
extra_fields = matches.flatten - fields.map { |f| f["name"] }
|
||||||
expect(extra_fields).to be_empty
|
expect(extra_fields).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "license meta" do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
|
|
||||||
# Manually load the raw license so we don't get thed defaults
|
# Manually load the raw license so we don't get thed defaults
|
||||||
raw_fields = SafeYAML.load_file("_licenses/#{license["id"]}.txt")
|
raw_fields = SafeYAML.load_file("_licenses/#{license["id"]}.txt")
|
||||||
|
|
||||||
describe "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
|
||||||
extra_fields = raw_fields.keys - meta.map { |m| m["name"] }
|
extra_fields = raw_fields.keys - meta.map { |m| m["name"] }
|
||||||
expect(extra_fields).to be_empty
|
expect(extra_fields).to be_empty
|
||||||
@ -30,3 +31,4 @@ licenses.each do |license|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "license rules" do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
|
|
||||||
groups = rules.keys
|
groups = rules.keys
|
||||||
|
|
||||||
describe "The #{license["title"]} license" do
|
context "The #{license["title"]} license" do
|
||||||
groups.each do |group|
|
groups.each do |group|
|
||||||
|
|
||||||
valid_tags = rules[group].map { |r| r["tag"] }
|
valid_tags = rules[group].map { |r| r["tag"] }
|
||||||
|
|
||||||
describe "the #{group} group" do
|
context "the #{group} group" do
|
||||||
it "should exist" do
|
it "should exist" do
|
||||||
expect(license[group]).to_not be_nil
|
expect(license[group]).to_not be_nil
|
||||||
end
|
end
|
||||||
@ -22,3 +23,4 @@ licenses.each do |license|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "licenses" do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
|
|
||||||
# "No license" isn't really a license, so no need to test
|
# "No license" isn't really a license, so no need to test
|
||||||
next if license["id"] == "no-license"
|
next if license["id"] == "no-license"
|
||||||
|
|
||||||
describe "The #{license["title"]} license" do
|
context "The #{license["title"]} license" do
|
||||||
|
|
||||||
let(:id) { license["id"] }
|
let(:id) { license["id"] }
|
||||||
|
|
||||||
@ -25,3 +26,4 @@ licenses.each do |license|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user