Skip to content

Commit dc1cc77

Browse files
committed
add tests
1 parent d865bf1 commit dc1cc77

8 files changed

Lines changed: 154 additions & 49 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ gem "github-pages"
66
group :test do
77
gem "html-proofer"
88
gem "rake"
9+
gem "rspec"
910
end

Gemfile.lock

Lines changed: 75 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,66 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
RedCloth (4.2.9)
5-
activesupport (4.1.5)
6-
i18n (~> 0.6, >= 0.6.9)
5+
activesupport (4.2.0)
6+
i18n (~> 0.7)
77
json (~> 1.7, >= 1.7.7)
88
minitest (~> 5.1)
9-
thread_safe (~> 0.1)
9+
thread_safe (~> 0.3, >= 0.3.4)
1010
tzinfo (~> 1.1)
11+
addressable (2.3.7)
1112
blankslate (2.1.2.4)
1213
celluloid (0.16.0)
1314
timers (~> 4.0.0)
14-
classifier-reborn (2.0.1)
15+
classifier-reborn (2.0.3)
1516
fast-stemmer (~> 1.0)
1617
coffee-script (2.3.0)
1718
coffee-script-source
1819
execjs
19-
coffee-script-source (1.8.0)
20+
coffee-script-source (1.9.1)
2021
colorator (0.1)
2122
colored (1.2)
22-
ethon (0.7.1)
23+
diff-lcs (1.2.5)
24+
ethon (0.7.3)
2325
ffi (>= 1.3.0)
24-
execjs (2.2.1)
26+
execjs (2.4.0)
2527
fast-stemmer (1.0.2)
26-
ffi (1.9.3)
28+
ffi (1.9.6)
2729
gemoji (2.1.0)
28-
github-pages (24)
30+
github-pages (33)
2931
RedCloth (= 4.2.9)
30-
jekyll (= 2.3.0)
31-
jekyll-coffeescript (= 1.0.0)
32-
jekyll-mentions (= 0.1.3)
33-
jekyll-redirect-from (= 0.6.0)
32+
github-pages-health-check (~> 0.2)
33+
jekyll (= 2.4.0)
34+
jekyll-coffeescript (= 1.0.1)
35+
jekyll-mentions (= 0.2.1)
36+
jekyll-redirect-from (= 0.6.2)
3437
jekyll-sass-converter (= 1.2.0)
35-
jekyll-sitemap (= 0.5.1)
36-
jemoji (= 0.3.0)
37-
kramdown (= 1.3.1)
38+
jekyll-sitemap (= 0.6.3)
39+
jemoji (= 0.4.0)
40+
kramdown (= 1.5.0)
3841
liquid (= 2.6.1)
3942
maruku (= 0.7.0)
40-
pygments.rb (= 0.6.0)
43+
mercenary (~> 0.3)
44+
pygments.rb (= 0.6.1)
4145
rdiscount (= 2.1.7)
4246
redcarpet (= 3.1.2)
47+
terminal-table (~> 1.4)
48+
github-pages-health-check (0.2.2)
49+
net-dns (~> 0.6)
50+
public_suffix (~> 1.4)
4351
hitimes (1.2.2)
4452
html-pipeline (1.9.0)
4553
activesupport (>= 2)
4654
nokogiri (~> 1.4)
47-
html-proofer (1.3.3)
55+
html-proofer (2.1.0)
56+
addressable (~> 2.3)
4857
colored (~> 1.2)
4958
mercenary (~> 0.3.2)
5059
nokogiri (~> 1.5)
51-
typhoeus (~> 0.6.7)
60+
parallel (~> 1.3)
61+
typhoeus (~> 0.7)
5262
yell (~> 2.0)
53-
i18n (0.6.11)
54-
jekyll (2.3.0)
63+
i18n (0.7.0)
64+
jekyll (2.4.0)
5565
classifier-reborn (~> 2.0)
5666
colorator (~> 0.1)
5767
jekyll-coffeescript (~> 1.0)
@@ -66,62 +76,79 @@ GEM
6676
redcarpet (~> 3.1)
6777
safe_yaml (~> 1.0)
6878
toml (~> 0.1.0)
69-
jekyll-coffeescript (1.0.0)
79+
jekyll-coffeescript (1.0.1)
7080
coffee-script (~> 2.2)
7181
jekyll-gist (1.1.0)
72-
jekyll-mentions (0.1.3)
82+
jekyll-mentions (0.2.1)
7383
html-pipeline (~> 1.9.0)
7484
jekyll (~> 2.0)
75-
jekyll-paginate (1.0.0)
76-
jekyll-redirect-from (0.6.0)
85+
jekyll-paginate (1.1.0)
86+
jekyll-redirect-from (0.6.2)
7787
jekyll (~> 2.0)
7888
jekyll-sass-converter (1.2.0)
7989
sass (~> 3.2)
80-
jekyll-sitemap (0.5.1)
81-
jekyll-watch (1.1.0)
90+
jekyll-sitemap (0.6.3)
91+
jekyll-watch (1.2.1)
8292
listen (~> 2.7)
83-
jemoji (0.3.0)
93+
jemoji (0.4.0)
8494
gemoji (~> 2.0)
8595
html-pipeline (~> 1.9)
8696
jekyll (~> 2.0)
87-
json (1.8.1)
88-
kramdown (1.3.1)
97+
json (1.8.2)
98+
kramdown (1.5.0)
8999
liquid (2.6.1)
90-
listen (2.7.9)
100+
listen (2.8.5)
91101
celluloid (>= 0.15.2)
92102
rb-fsevent (>= 0.9.3)
93103
rb-inotify (>= 0.9)
94104
maruku (0.7.0)
95-
mercenary (0.3.4)
96-
mini_portile (0.6.0)
97-
minitest (5.4.1)
98-
nokogiri (1.6.3.1)
99-
mini_portile (= 0.6.0)
105+
mercenary (0.3.5)
106+
mini_portile (0.6.2)
107+
minitest (5.5.1)
108+
net-dns (0.8.0)
109+
nokogiri (1.6.6.2)
110+
mini_portile (~> 0.6.0)
111+
parallel (1.4.1)
100112
parslet (1.5.0)
101113
blankslate (~> 2.0)
102-
posix-spawn (0.3.9)
103-
pygments.rb (0.6.0)
114+
posix-spawn (0.3.10)
115+
public_suffix (1.4.6)
116+
pygments.rb (0.6.1)
104117
posix-spawn (~> 0.3.6)
105-
yajl-ruby (~> 1.1.0)
106-
rake (10.3.2)
118+
yajl-ruby (~> 1.2.0)
119+
rake (10.4.2)
107120
rb-fsevent (0.9.4)
108121
rb-inotify (0.9.5)
109122
ffi (>= 0.5.0)
110123
rdiscount (2.1.7)
111124
redcarpet (3.1.2)
112-
safe_yaml (1.0.3)
113-
sass (3.4.3)
125+
rspec (3.2.0)
126+
rspec-core (~> 3.2.0)
127+
rspec-expectations (~> 3.2.0)
128+
rspec-mocks (~> 3.2.0)
129+
rspec-core (3.2.1)
130+
rspec-support (~> 3.2.0)
131+
rspec-expectations (3.2.0)
132+
diff-lcs (>= 1.2.0, < 2.0)
133+
rspec-support (~> 3.2.0)
134+
rspec-mocks (3.2.1)
135+
diff-lcs (>= 1.2.0, < 2.0)
136+
rspec-support (~> 3.2.0)
137+
rspec-support (3.2.2)
138+
safe_yaml (1.0.4)
139+
sass (3.4.13)
140+
terminal-table (1.4.5)
114141
thread_safe (0.3.4)
115-
timers (4.0.0)
142+
timers (4.0.1)
116143
hitimes
117-
toml (0.1.1)
144+
toml (0.1.2)
118145
parslet (~> 1.5.0)
119-
typhoeus (0.6.9)
146+
typhoeus (0.7.1)
120147
ethon (>= 0.7.1)
121148
tzinfo (1.2.2)
122149
thread_safe (~> 0.1)
123-
yajl-ruby (1.1.0)
124-
yell (2.0.4)
150+
yajl-ruby (1.2.1)
151+
yell (2.0.5)
125152

126153
PLATFORMS
127154
ruby
@@ -130,3 +157,4 @@ DEPENDENCIES
130157
github-pages
131158
html-proofer
132159
rake
160+
rspec

Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
require "html/proofer"
2+
require 'rspec/core/rake_task'
3+
4+
desc "Run specs"
5+
RSpec::Core::RakeTask.new do |t|
6+
t.pattern = 'spec/**/*_spec.rb'
7+
t.rspec_opts = ["--order", "rand", "--color"]
8+
end
29

310
task :test do
411
sh "bundle exec jekyll build --trace"

_licenses/apache-2.0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ source: http://www.apache.org/licenses/LICENSE-2.0.html
1818
required:
1919
- include-copyright
2020
- document-changes
21-
21+
2222
permitted:
2323
- commercial-use
2424
- modifications

_licenses/cc0.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ permitted:
2525
forbidden:
2626
- no-liability
2727

28+
required: []
29+
2830
---
2931
CC0 1.0 Universal
3032

@@ -141,4 +143,4 @@ Affirmer's express Statement of Purpose.
141143
CC0 or use of the Work.
142144

143145
For more information, please see
144-
<http://creativecommons.org/publicdomain/zero/1.0/>
146+
<http://creativecommons.org/publicdomain/zero/1.0/>

_licenses/unlicense.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ permitted:
2525
forbidden:
2626
- no-liability
2727

28+
required: []
29+
2830
---
2931
This is free and unencumbered software released into the public domain.
3032

spec/license_spec.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require 'spec_helper'
2+
3+
licenses.each do |license|
4+
describe "The #{license["title"]} license" do
5+
it "should have a title" do
6+
expect(license["title"]).to_not be_nil
7+
end
8+
9+
it "should have a description" do
10+
expect(license["description"]).to_not be_nil
11+
end
12+
13+
["permitted", "required", "forbidden"].each do |group|
14+
describe "#{group} properties" do
15+
it "should list the properties" do
16+
expect(license[group]).to_not be_nil
17+
end
18+
19+
license[group].to_a.each do |tag|
20+
describe "#{tag} tag" do
21+
it "should be a valid tag" do
22+
expect(rule?(tag,group)).to be(true)
23+
end
24+
end
25+
end
26+
end
27+
end
28+
end
29+
end

spec/spec_helper.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require 'jekyll'
2+
3+
def config_file
4+
File.expand_path "./_config.yml", source
5+
end
6+
7+
def source
8+
File.expand_path("../", File.dirname(__FILE__))
9+
end
10+
11+
def config
12+
config = Jekyll::Configuration.new.read_config_file config_file
13+
config = Jekyll::Utils.deep_merge_hashes(config, {:source => source})
14+
Jekyll::Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, config)
15+
end
16+
17+
def licenses
18+
site.collections["licenses"].docs.map { |l| l.data }
19+
end
20+
21+
def site
22+
$site ||= begin
23+
site = Jekyll::Site.new(config)
24+
site.reset
25+
site.read
26+
site
27+
end
28+
end
29+
30+
def rules
31+
site.data["rules"]
32+
end
33+
34+
def rule?(tag, group)
35+
rules[group].any? { |r| r["tag"] == tag }
36+
end

0 commit comments

Comments
 (0)