2015-08-22 15:25:16 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-09-09 00:04:34 +01:00
|
|
|
families.each do |family|
|
|
|
|
describe "the #{family} family" do
|
|
|
|
family_licenses = licenses.select { |l| l["family"] == family }
|
|
|
|
primary = family_licenses.select { |l| l["variant"] == false }
|
|
|
|
variants = family_licenses.select { |l| l["variant"] == true }
|
2015-08-22 15:25:16 -04:00
|
|
|
|
|
|
|
it "should only have one primary license" do
|
|
|
|
expect(primary.count).to eql(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "all other licenses should be variants" do
|
2015-09-09 00:04:34 +01:00
|
|
|
expected = family_licenses.count - 1
|
2015-08-22 15:25:16 -04:00
|
|
|
expect(variants.count).to eql(expected)
|
|
|
|
end
|
|
|
|
|
2015-09-09 00:04:34 +01:00
|
|
|
family_licenses.each do |license|
|
2015-08-22 15:25:16 -04:00
|
|
|
describe "the #{license["title"]} license" do
|
|
|
|
it "should have a unique slug" do
|
2015-09-09 00:04:34 +01:00
|
|
|
dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
|
2015-08-22 15:25:16 -04:00
|
|
|
expect(dupes).to eql(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should have a valid tab-slug" do
|
|
|
|
expect(license["tab-slug"]).to match(/[a-z0-9_]/)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|