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

add tests

This commit is contained in:
Ben Balter 2015-03-07 12:47:24 -05:00
parent d865bf19c2
commit dc1cc773a1
8 changed files with 154 additions and 49 deletions

View File

@ -6,4 +6,5 @@ gem "github-pages"
group :test do group :test do
gem "html-proofer" gem "html-proofer"
gem "rake" gem "rake"
gem "rspec"
end end

View File

@ -2,56 +2,66 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
RedCloth (4.2.9) RedCloth (4.2.9)
activesupport (4.1.5) activesupport (4.2.0)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.1) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.7)
blankslate (2.1.2.4) blankslate (2.1.2.4)
celluloid (0.16.0) celluloid (0.16.0)
timers (~> 4.0.0) timers (~> 4.0.0)
classifier-reborn (2.0.1) classifier-reborn (2.0.3)
fast-stemmer (~> 1.0) fast-stemmer (~> 1.0)
coffee-script (2.3.0) coffee-script (2.3.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.8.0) coffee-script-source (1.9.1)
colorator (0.1) colorator (0.1)
colored (1.2) colored (1.2)
ethon (0.7.1) diff-lcs (1.2.5)
ethon (0.7.3)
ffi (>= 1.3.0) ffi (>= 1.3.0)
execjs (2.2.1) execjs (2.4.0)
fast-stemmer (1.0.2) fast-stemmer (1.0.2)
ffi (1.9.3) ffi (1.9.6)
gemoji (2.1.0) gemoji (2.1.0)
github-pages (24) github-pages (33)
RedCloth (= 4.2.9) RedCloth (= 4.2.9)
jekyll (= 2.3.0) github-pages-health-check (~> 0.2)
jekyll-coffeescript (= 1.0.0) jekyll (= 2.4.0)
jekyll-mentions (= 0.1.3) jekyll-coffeescript (= 1.0.1)
jekyll-redirect-from (= 0.6.0) jekyll-mentions (= 0.2.1)
jekyll-redirect-from (= 0.6.2)
jekyll-sass-converter (= 1.2.0) jekyll-sass-converter (= 1.2.0)
jekyll-sitemap (= 0.5.1) jekyll-sitemap (= 0.6.3)
jemoji (= 0.3.0) jemoji (= 0.4.0)
kramdown (= 1.3.1) kramdown (= 1.5.0)
liquid (= 2.6.1) liquid (= 2.6.1)
maruku (= 0.7.0) maruku (= 0.7.0)
pygments.rb (= 0.6.0) mercenary (~> 0.3)
pygments.rb (= 0.6.1)
rdiscount (= 2.1.7) rdiscount (= 2.1.7)
redcarpet (= 3.1.2) redcarpet (= 3.1.2)
terminal-table (~> 1.4)
github-pages-health-check (0.2.2)
net-dns (~> 0.6)
public_suffix (~> 1.4)
hitimes (1.2.2) hitimes (1.2.2)
html-pipeline (1.9.0) html-pipeline (1.9.0)
activesupport (>= 2) activesupport (>= 2)
nokogiri (~> 1.4) nokogiri (~> 1.4)
html-proofer (1.3.3) html-proofer (2.1.0)
addressable (~> 2.3)
colored (~> 1.2) colored (~> 1.2)
mercenary (~> 0.3.2) mercenary (~> 0.3.2)
nokogiri (~> 1.5) nokogiri (~> 1.5)
typhoeus (~> 0.6.7) parallel (~> 1.3)
typhoeus (~> 0.7)
yell (~> 2.0) yell (~> 2.0)
i18n (0.6.11) i18n (0.7.0)
jekyll (2.3.0) jekyll (2.4.0)
classifier-reborn (~> 2.0) classifier-reborn (~> 2.0)
colorator (~> 0.1) colorator (~> 0.1)
jekyll-coffeescript (~> 1.0) jekyll-coffeescript (~> 1.0)
@ -66,62 +76,79 @@ GEM
redcarpet (~> 3.1) redcarpet (~> 3.1)
safe_yaml (~> 1.0) safe_yaml (~> 1.0)
toml (~> 0.1.0) toml (~> 0.1.0)
jekyll-coffeescript (1.0.0) jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2) coffee-script (~> 2.2)
jekyll-gist (1.1.0) jekyll-gist (1.1.0)
jekyll-mentions (0.1.3) jekyll-mentions (0.2.1)
html-pipeline (~> 1.9.0) html-pipeline (~> 1.9.0)
jekyll (~> 2.0) jekyll (~> 2.0)
jekyll-paginate (1.0.0) jekyll-paginate (1.1.0)
jekyll-redirect-from (0.6.0) jekyll-redirect-from (0.6.2)
jekyll (~> 2.0) jekyll (~> 2.0)
jekyll-sass-converter (1.2.0) jekyll-sass-converter (1.2.0)
sass (~> 3.2) sass (~> 3.2)
jekyll-sitemap (0.5.1) jekyll-sitemap (0.6.3)
jekyll-watch (1.1.0) jekyll-watch (1.2.1)
listen (~> 2.7) listen (~> 2.7)
jemoji (0.3.0) jemoji (0.4.0)
gemoji (~> 2.0) gemoji (~> 2.0)
html-pipeline (~> 1.9) html-pipeline (~> 1.9)
jekyll (~> 2.0) jekyll (~> 2.0)
json (1.8.1) json (1.8.2)
kramdown (1.3.1) kramdown (1.5.0)
liquid (2.6.1) liquid (2.6.1)
listen (2.7.9) listen (2.8.5)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
maruku (0.7.0) maruku (0.7.0)
mercenary (0.3.4) mercenary (0.3.5)
mini_portile (0.6.0) mini_portile (0.6.2)
minitest (5.4.1) minitest (5.5.1)
nokogiri (1.6.3.1) net-dns (0.8.0)
mini_portile (= 0.6.0) nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
parallel (1.4.1)
parslet (1.5.0) parslet (1.5.0)
blankslate (~> 2.0) blankslate (~> 2.0)
posix-spawn (0.3.9) posix-spawn (0.3.10)
pygments.rb (0.6.0) public_suffix (1.4.6)
pygments.rb (0.6.1)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0) yajl-ruby (~> 1.2.0)
rake (10.3.2) rake (10.4.2)
rb-fsevent (0.9.4) rb-fsevent (0.9.4)
rb-inotify (0.9.5) rb-inotify (0.9.5)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdiscount (2.1.7) rdiscount (2.1.7)
redcarpet (3.1.2) redcarpet (3.1.2)
safe_yaml (1.0.3) rspec (3.2.0)
sass (3.4.3) rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.1)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
safe_yaml (1.0.4)
sass (3.4.13)
terminal-table (1.4.5)
thread_safe (0.3.4) thread_safe (0.3.4)
timers (4.0.0) timers (4.0.1)
hitimes hitimes
toml (0.1.1) toml (0.1.2)
parslet (~> 1.5.0) parslet (~> 1.5.0)
typhoeus (0.6.9) typhoeus (0.7.1)
ethon (>= 0.7.1) ethon (>= 0.7.1)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
yajl-ruby (1.1.0) yajl-ruby (1.2.1)
yell (2.0.4) yell (2.0.5)
PLATFORMS PLATFORMS
ruby ruby
@ -130,3 +157,4 @@ DEPENDENCIES
github-pages github-pages
html-proofer html-proofer
rake rake
rspec

View File

@ -1,4 +1,11 @@
require "html/proofer" require "html/proofer"
require 'rspec/core/rake_task'
desc "Run specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rspec_opts = ["--order", "rand", "--color"]
end
task :test do task :test do
sh "bundle exec jekyll build --trace" sh "bundle exec jekyll build --trace"

View File

@ -18,7 +18,7 @@ source: http://www.apache.org/licenses/LICENSE-2.0.html
required: required:
- include-copyright - include-copyright
- document-changes - document-changes
permitted: permitted:
- commercial-use - commercial-use
- modifications - modifications

View File

@ -25,6 +25,8 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
required: []
--- ---
CC0 1.0 Universal CC0 1.0 Universal
@ -141,4 +143,4 @@ Affirmer's express Statement of Purpose.
CC0 or use of the Work. CC0 or use of the Work.
For more information, please see For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/> <http://creativecommons.org/publicdomain/zero/1.0/>

View File

@ -25,6 +25,8 @@ permitted:
forbidden: forbidden:
- no-liability - no-liability
required: []
--- ---
This is free and unencumbered software released into the public domain. This is free and unencumbered software released into the public domain.

29
spec/license_spec.rb Normal file
View File

@ -0,0 +1,29 @@
require 'spec_helper'
licenses.each do |license|
describe "The #{license["title"]} license" do
it "should have a title" do
expect(license["title"]).to_not be_nil
end
it "should have a description" do
expect(license["description"]).to_not be_nil
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

36
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,36 @@
require 'jekyll'
def config_file
File.expand_path "./_config.yml", source
end
def source
File.expand_path("../", File.dirname(__FILE__))
end
def config
config = Jekyll::Configuration.new.read_config_file config_file
config = Jekyll::Utils.deep_merge_hashes(config, {:source => source})
Jekyll::Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, config)
end
def licenses
site.collections["licenses"].docs.map { |l| l.data }
end
def site
$site ||= begin
site = Jekyll::Site.new(config)
site.reset
site.read
site
end
end
def rules
site.data["rules"]
end
def rule?(tag, group)
rules[group].any? { |r| r["tag"] == tag }
end