1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 04:40:09 +01:00

add rules spec

This commit is contained in:
Ben Balter 2015-08-22 15:42:12 -04:00
parent 26493bff3c
commit df0fd9213f
4 changed files with 26 additions and 18 deletions

View File

@ -20,7 +20,7 @@ permitted:
- modifications
- distribution
- private-use
forbidden:
- no-liability

View File

@ -16,7 +16,7 @@ licenses.each do |license|
missing = required - raw_fields.keys
expect(missing).to be_empty
end
if license["category"]
it "should contain the required license variant fields" do
missing = ["category", "tab-slug"] - license.keys

View File

@ -0,0 +1,24 @@
require 'spec_helper'
licenses.each do |license|
groups = rules.keys
describe "The #{license["title"]} license" do
groups.each do |group|
valid_tags = rules[group].map { |r| r["tag"] }
describe "the #{group} group" do
it "should exist" do
expect(license[group]).to_not be_nil
end
it "should only contain valid tags" do
extra = license[group] - valid_tags
expect(extra).to be_empty
end
end
end
end
end

View File

@ -31,21 +31,5 @@ licenses.each do |license|
end
end
end
["permitted", "required", "forbidden"].each do |group|
describe "#{group} properties" do
it "should list the properties" do
expect(license[group]).to_not be_nil
end
license[group].to_a.each do |tag|
describe "#{tag} tag" do
it "should be a valid tag" do
expect(rule?(tag,group)).to be(true)
end
end
end
end
end
end
end