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:
parent
26493bff3c
commit
df0fd9213f
@ -20,7 +20,7 @@ permitted:
|
||||
- modifications
|
||||
- distribution
|
||||
- private-use
|
||||
|
||||
|
||||
forbidden:
|
||||
- no-liability
|
||||
|
||||
|
@ -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
|
||||
|
24
spec/license_rules_spec.rb
Normal file
24
spec/license_rules_spec.rb
Normal 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
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user