1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 21:00:10 +01:00
choosealicense.com/spec/license_category_spec.rb

34 lines
1.0 KiB
Ruby
Raw Normal View History

2015-08-22 15:25:16 -04:00
require 'spec_helper'
2016-02-08 15:37:19 -05:00
describe 'license categories' do
2016-01-20 10:20:04 -05:00
families.each do |family|
context "the #{family} family" do
2016-02-08 15:37:19 -05:00
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
2016-02-08 15:37:19 -05:00
it 'should only have one primary license' do
2016-01-20 10:20:04 -05:00
expect(primary.count).to eql(1)
end
2015-08-22 15:25:16 -04:00
2016-02-08 15:37:19 -05:00
it 'all other licenses should be variants' do
2016-01-20 10:20:04 -05:00
expected = family_licenses.count - 1
expect(variants.count).to eql(expected)
end
2015-08-22 15:25:16 -04:00
2016-01-20 10:20:04 -05:00
family_licenses.each do |license|
2016-02-08 15:37:19 -05:00
context "the #{license['title']} license" do
it 'should have a unique slug' do
dupes = family_licenses.count { |l| l['tab-slug'] == license['tab-slug'] }
2016-01-20 10:20:04 -05:00
expect(dupes).to eql(1)
end
2015-08-22 15:25:16 -04:00
2016-02-08 15:37:19 -05:00
it 'should have a valid tab-slug' do
expect(license['tab-slug']).to match(/[a-z0-9_]/)
2016-01-20 10:20:04 -05:00
end
2015-08-22 15:25:16 -04:00
end
end
end
end
end