mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
add rules spec
This commit is contained in:
parent
26493bff3c
commit
df0fd9213f
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