earl-report 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,17 +42,17 @@
42
42
  - require 'digest'
43
43
 
44
44
  !!! 5
45
- %html{:prefix => "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"}
45
+ %html{prefix: "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"}
46
46
  - subjects = tests['testSubjects']
47
47
  %head
48
- %meta{"http-equiv" => "Content-Type", :content => "text/html;charset=utf-8"}
49
- %link{:rel => "alternate", :href => "earl.ttl"}
50
- %link{:rel => "alternate", :href => "earl.jsonld"}
48
+ %meta{"http-equiv" => "Content-Type", content: "text/html;charset=utf-8"}
49
+ %link{rel: "alternate", href: "earl.ttl"}
50
+ %link{rel: "alternate", href: "earl.jsonld"}
51
51
  - tests['assertions'].each do |file|
52
- %link{:rel => "related", :href => file}
52
+ %link{rel: "related", href: file}
53
53
  %title
54
54
  = tests['name']
55
- %script.remove{:type => "text/javascript", :src => "http://www.w3.org/Tools/respec/respec-w3c-common"}
55
+ %script.remove{type: "text/javascript", src: "http://www.w3.org/Tools/respec/respec-w3c-common"}
56
56
  :javascript
57
57
  var respecConfig = {
58
58
  // extend the bibliography entries
@@ -85,12 +85,6 @@
85
85
  // if this is a LCWD, uncomment and set the end of its review period
86
86
  // lcEnd: "2009-08-05",
87
87
 
88
- // if you want to have extra CSS, append them to this list
89
- // it is recommended that the respec.css stylesheet be kept
90
- extraCSS: [
91
- "http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"
92
- ],
93
-
94
88
  // editors, add as many as you like
95
89
  // only "name" is required
96
90
  editors: [
@@ -127,7 +121,7 @@
127
121
  ],
128
122
  };
129
123
  :css
130
- span[property='dc:description'] { display: none; }
124
+ span[property='dc:description rdfs:comment'] { display: none; }
131
125
  td.PASS { color: green; }
132
126
  td.FAIL { color: red; }
133
127
  table.report {
@@ -158,20 +152,20 @@
158
152
  td.passed-all {color: green;}
159
153
  td.passed-most {color: darkorange;}
160
154
  td.passed-some {color: red;}
161
- %body{:prefix => "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"}
162
- %section#abstract{:about => tests['@id'], :typeof => Array(tests['@type']).join(" ")}
155
+ %body{prefix: "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#", vocab: "http://www.w3.org/ns/earl#"}
156
+ %section#abstract{about: tests['@id'], typeof: Array(tests['@type']).join(" ")}
163
157
  %p
164
158
  This document report test subject conformance for and related specifications for
165
- %span{:property => "doap:name"}<=tests['name']
166
- %span{:property => "dc:bibliographicCitation"}<
159
+ %span{property: "doap:name"}<=tests['name']
160
+ %span{property: "dc:bibliographicCitation"}<
167
161
  = tests['bibRef']
168
162
  according to the requirements of the Evaluation and Report Language (EARL) 1.0 Schema [[EARL10-SCHEMA]].
169
163
  %p
170
164
  This report is also available in alternate formats:
171
- %a{:rel => "xhv:alternate", :href => "earl.ttl"}
165
+ %a{rel: "xhv:alternate", href: "earl.ttl"}
172
166
  Turtle
173
167
  and
174
- %a{:rel => "xhv:alternate", :href => "earl.jsonld"}
168
+ %a{rel: "xhv:alternate", href: "earl.jsonld"}
175
169
  JSON-LD
176
170
  %section#sodt
177
171
  %section
@@ -182,11 +176,12 @@
182
176
  Test Manifests
183
177
  - tests['entries'].each do |manifest|
184
178
  - test_cases = manifest['entries']
185
- %section{:typeof => manifest['@type'].join(" "), :resource => manifest['@id']}
186
- %h2{:property => "dc:title mf:name"}<=manifest['title'] || 'Test Manifest'
179
+ %section{typeof: manifest['@type'].join(" "), resource: manifest['@id']}
180
+ %h2{property: "dc:title mf:name"}<=manifest['title'] || 'Test Manifest'
187
181
  - Array(manifest['description']).each do |desc|
188
- %p{:property => "rdfs:comment"}<
189
- ~ CGI.escapeHTML desc
182
+ - desc = desc['@value'] if desc.is_a?(Hash)
183
+ %p{property: "rdfs:comment", lang: 'en'}<
184
+ ~ CGI.escapeHTML desc.to_s
190
185
  %table.report
191
186
  - skip_subject = {}
192
187
  - passed_tests = []
@@ -199,35 +194,36 @@
199
194
  - skip_subject[subject['@id']] = manifest['entries'].all? {|t| t['assertions'][index]['result']['outcome'] == 'earl:untested'}
200
195
  - unless skip_subject[subject['@id']]
201
196
  %th
202
- %a{:href => '#' + subject_refs[subject['@id']]}<=subject['name']
197
+ %a{href: '#' + subject_refs[subject['@id']]}<=subject['name']
203
198
  - test_cases.each do |test|
204
199
  - tid = "test_#{Digest::MD5.hexdigest(test['@id'])}"
205
200
  - (test_info[tid] ||= []) << test
206
201
  - test_refs[test['@id']] = tid
207
- %tr{:rel => "mf:entries", :typeof => test['@type'].join(" "), :resource => test['@id'], :inlist => true}
202
+ %tr{rel: "mf:entries", typeof: test['@type'].join(" "), resource: test['@id'], inlist: true}
208
203
  %td
209
- %a{:href => "##{tid}"}<
210
- ~ CGI.escapeHTML test['title']
204
+ %a{href: "##{tid}"}<
205
+ ~ CGI.escapeHTML test['title'].to_s
206
+ - # test['assertions'] = [] unless test.has_key?('assertions')
211
207
  - test['assertions'].each_with_index do |assertion, ndx|
212
208
  - next if skip_subject[assertion['subject']]
213
209
  - pass_fail = assertion['result']['outcome'].split(':').last.upcase.sub(/(PASS|FAIL)ED$/, '\1')
214
210
  - passed_tests[ndx] = (passed_tests[ndx] || 0) + (pass_fail == 'PASS' ? 1 : 0)
215
- %td{:class => pass_fail, :property => "earl:assertions", :typeof => assertion['@type'], :inlist => true}
211
+ %td{class: pass_fail, property: "earl:assertions", typeof: assertion['@type']}
216
212
  - if assertion['assertedBy']
217
- %link{:property => "earl:assertedBy", :href => assertion['assertedBy']}
218
- %link{:property => "earl:test", :href => assertion['test']}
219
- %link{:property => "earl:subject", :href => assertion['subject']}
213
+ %link{property: "earl:assertedBy", href: assertion['assertedBy']}
214
+ %link{property: "earl:test", href: assertion['test']}
215
+ %link{property: "earl:subject", href: assertion['subject']}
220
216
  - if assertion['mode']
221
- %link{:property => 'earl:mode', :href => assertion['mode']}
222
- %span{:property => "earl:result", :typeof => assertion['result']['@type']}
223
- %span{:property => 'earl:outcome', :resource => assertion['result']['outcome']}
217
+ %link{property: 'earl:mode', href: assertion['mode']}
218
+ %span{property: "earl:result", typeof: assertion['result']['@type']}
219
+ %span{property: 'earl:outcome', resource: assertion['result']['outcome']}
224
220
  = pass_fail
225
221
  %tr.summary
226
222
  %td
227
223
  = "Percentage passed out of #{manifest['entries'].length} Tests"
228
224
  - passed_tests.compact.each do |r|
229
225
  - pct = (r * 100.0) / manifest['entries'].length
230
- %td{:class => (pct == 100.0 ? 'passed-all' : (pct >= 95.0 ? 'passed-most' : 'passed-some'))}
226
+ %td{class: (pct == 100.0 ? 'passed-all' : (pct >= 95.0 ? 'passed-most' : 'passed-some'))}
231
227
  = "#{'%.1f' % pct}%"
232
228
  %section.appendix
233
229
  %h2
@@ -236,38 +232,39 @@
236
232
  This report was tested using the following test subjects:
237
233
  %dl
238
234
  - subjects.each_with_index do |subject, index|
239
- %dt{:id => subject_refs[subject['@id']]}
240
- %a{:href => subject['@id']}
241
- %span{:about => subject['@id'], :property => "doap:name"}<= subject['name']
242
- %dd{:property => "earl:testSubjects", :resource => subject['@id'], :typeof => Array(subject['@type']).join(" "), :inlist => true}
235
+ %dt{id: subject_refs[subject['@id']]}
236
+ %a{href: subject['@id']}
237
+ %span{about: subject['@id'], property: "doap:name"}<= subject['name']
238
+ %dd{property: "earl:testSubjects", resource: subject['@id'], typeof: Array(subject['@type']).join(" ")}
243
239
  %dl
244
240
  - if subject['doapDesc']
241
+ - subject['doapDesc'] = subject['doapDesc']['@value'] if subject['doapDesc'].is_a?(Hash)
245
242
  %dt= "Description"
246
- %dd{:property => "doap:description", :lang => 'en'}<
243
+ %dd{property: "doap:description", lang: 'en'}<
247
244
  ~ CGI.escapeHTML subject['doapDesc']
248
245
  - if subject['language']
246
+ - subject['language'] = subject['language']['@value'] if subject['language'].is_a?(Hash)
249
247
  %dt= "Programming Language"
250
- %dd{:property => "doap:programming-language"}<
251
- ~ CGI.escapeHTML subject['language']
248
+ %dd{property: "doap:programming-language"}<
249
+ ~ CGI.escapeHTML subject['language'].to_s
252
250
  - if subject['homepage']
253
251
  %dt= "Home Page"
254
- %dd{:property => "doap:homepage"}
255
- %a{:href=> subject['homepage']}
256
- ~ CGI.escapeHTML subject['homepage']
252
+ %dd{property: "doap:homepage"}
253
+ %a{href: subject['homepage']}
254
+ ~ CGI.escapeHTML subject['homepage'].to_s
257
255
  - if subject['developer']
258
256
  %dt= "Developer"
259
- %dd{:rel => "doap:developer"}
260
- - subject['developer'].each do |dev|
261
- %div{:resource => dev['@id'], :typeof => Array(dev['@type']).join(" ")}
257
+ - subject['developer'].each do |dev|
258
+ %dd{rel: "doap:developer"}
259
+ %div{resource: dev['@id'], typeof: Array(dev['@type']).join(" ")}
262
260
  - if dev.has_key?('@id')
263
- %a{:href => dev['@id']}
264
- %span{:property => "foaf:name"}<
265
- ~ CGI.escapeHTML dev['foaf:name']
261
+ %a{href: dev['@id']}
262
+ %span{property: "foaf:name"}<
263
+ ~ CGI.escapeHTML dev['foaf:name'].to_s
266
264
  - else
267
- %span{:property => "foaf:name"}<
268
- ~ CGI.escapeHTML dev['foaf:name']
265
+ %span{property: "foaf:name"}<
269
266
  - if dev['foaf:homepage']
270
- %a{:property => "foaf:homepage", :href=> dev['foaf:homepage']}
267
+ %a{property: "foaf:homepage", href: dev['foaf:homepage']}
271
268
  ~ CGI.escapeHTML dev['foaf:homepage']
272
269
  %dt
273
270
  Test Suite Compliance
@@ -275,17 +272,17 @@
275
272
  %table.report
276
273
  %tbody
277
274
  - tests['entries'].each do |manifest|
278
- - passed = manifest['entries'].select {|t| t['assertions'][index]['result']['outcome'] == 'earl:passed' }.length
275
+ - passed = manifest['entries'].select {|t| (t['assertions'][index] || {}).fetch('result', {})['outcome'] == 'earl:passed' }.length
279
276
  - next if passed == 0
280
277
  - total = manifest['entries'].length
281
278
  - pct = (passed * 100.0) / total
282
279
  %tr
283
280
  %td
284
281
  ~ manifest['title']
285
- %td{:class => (pct == 100.0 ? 'passed-all' : (pct >= 85.0 ? 'passed-most' : 'passed-some'))}
282
+ %td{class: (pct == 100.0 ? 'passed-all' : (pct >= 85.0 ? 'passed-most' : 'passed-some'))}
286
283
  = "#{passed}/#{total} (#{'%.1f' % pct}%)"
287
284
  - unless tests['assertions'].empty?
288
- %section.appendix{:rel => "xhv:related earl:assertions"}
285
+ %section.appendix{rel: "xhv:related earl:assertions"}
289
286
  %h2
290
287
  Individual Test Results
291
288
  %p
@@ -293,52 +290,53 @@
293
290
  %ul
294
291
  - tests['assertions'].each do |file|
295
292
  %li
296
- %a.source{:href => file}<= file
293
+ %a.source{href: file}<= file
297
294
  %section.appendix
298
295
  %h2
299
296
  Test Definitions
300
297
  %dl
301
298
  - tests['entries'].each do |manifest|
302
- %div{:property => "mf:entries", :inlist => true, :resource => manifest['@id']}
299
+ %div{property: "mf:entries", inlist: true, resource: manifest['@id']}
303
300
  - manifest['entries'].each do |test|
304
- %dt{:id => test_refs[test['@id']], :resource => test['@id']}
301
+ - test['description'] = test['description']['@value'] if test['description'].is_a?(Hash)
302
+ %dt{id: test_refs[test['@id']], resource: test['@id']}
305
303
  Test
306
- %span{:property => "dc:title mf:name"}<
307
- ~ CGI.escapeHTML test['title']
308
- %dd{:resource => test['@id']}
309
- %p{:property => "dc:description", :lang => 'en'}<
310
- ~ CGI.escapeHTML test['description']
311
- %pre{:class => "example actionDoc", :property => "mf:action", :resource => test['testAction'], :title => "#{test['title']} Input"}<
304
+ %span{property: "dc:title mf:name"}<
305
+ ~ CGI.escapeHTML test['title'].to_s
306
+ %dd{resource: test['@id']}
307
+ %p{property: "dc:description rdfs:comment"}<
308
+ ~ CGI.escapeHTML test['description'].to_s
309
+ %pre{class: "example actionDoc", property: "mf:action", resource: test['testAction'], title: "#{test['title']} Input"}<
312
310
  ~ Kernel.open(test['testAction']) {|f| f.set_encoding(Encoding::UTF_8); CGI.escapeHTML(f.read).gsub(/\n/, '<br/>')} rescue "#{test['testAction']} not loaded"
313
311
  - if test['testResult']
314
- %pre{:class => "example resultDoc", :property => "mf:result", :resource => test['testResult'], :title => "#{test['title']} Result"}<
312
+ %pre{class: "example resultDoc", property: "mf:result", resource: test['testResult'], title: "#{test['title']} Result"}<
315
313
  ~ Kernel.open(test['testResult']) {|f| f.set_encoding(Encoding::UTF_8); CGI.escapeHTML(f.read).gsub(/\n/, '<br/>')} rescue "#{test['testResult']} not loaded"
316
- %section#appendix{:property => "earl:generatedBy", :resource => tests['generatedBy']['@id'], :typeof => tests['generatedBy']['@type']}
314
+ %section#appendix{property: "earl:generatedBy", resource: tests['generatedBy']['@id'], typeof: Array(tests['generatedBy']['@type']).join(' ')}
317
315
  %h2
318
316
  Report Generation Software
319
317
  - doap = tests['generatedBy']
320
318
  - rel = doap['release']
321
319
  %p
322
320
  This report generated by
323
- %span{:property => "doap:name"}<
324
- %a{:href => tests['generatedBy']['@id']}<
321
+ %span{property: "doap:name"}<
322
+ %a{href: tests['generatedBy']['@id']}<
325
323
  = doap['name']
326
- %meta{:property => "doap:shortdesc", :content => doap['shortdesc'], :lang => 'en'}
327
- %meta{:property => "doap:description", :content => doap['doapDesc'], :lang => 'en'}
324
+ %meta{property: "doap:shortdesc", content: doap['shortdesc']}
325
+ %meta{property: "doap:description", content: doap['doapDesc']}
328
326
  version
329
- %span{:property => "doap:release", :resource => rel['@id'], :typeof => 'doap:Version'}
330
- %span{:property => "doap:revision"}<=rel['revision']
331
- %meta{:property => "doap:name", :content => rel['name']}
332
- %meta{:property => "doap:created", :content => rel['created'], :datatype => "xsd:date"}
327
+ %span{property: "doap:release", resource: rel['@id'], typeof: 'doap:Version'}
328
+ %span{property: "doap:revision"}<=rel['revision']
329
+ %meta{property: "doap:name", content: rel['name']}
330
+ %meta{property: "doap:created", content: rel['created'], datatype: "xsd:date"}
333
331
  an
334
- %a{:property => "doap:license", :href => doap['license']}<="Unlicensed"
335
- %span{:property => "doap:programming-language"}<="Ruby"
332
+ %a{property: "doap:license", href: doap['license']}<="Unlicensed"
333
+ %span{property: "doap:programming-language"}<="Ruby"
336
334
  application. More information is available at
337
- %a{:property => "doap:homepage", :href => doap['homepage']}<=doap['homepage']
335
+ %a{property: "doap:homepage", href: doap['homepage']}<=doap['homepage']
338
336
  = "."
339
- %p{:property => "doap:developer", :resource => "http://greggkellogg.net/foaf#me", :typeof => "foaf:Person"}
337
+ %p{property: "doap:developer", resource: "http://greggkellogg.net/foaf#me", typeof: "foaf:Person"}
340
338
  This software is provided by
341
- %a{:property => "foaf:homepage", :href => "http://greggkellogg.net/"}<
342
- %span{:aboue => "http://greggkellogg.net/foaf#me", :property => "foaf:name"}<
339
+ %a{property: "foaf:homepage", href: "http://greggkellogg.net/"}<
340
+ %span{about: "http://greggkellogg.net/foaf#me", property: "foaf:name"}<
343
341
  Gregg Kellogg
344
342
  in hopes that it might make the lives of conformance testers easier.
@@ -168,7 +168,7 @@ describe EarlReport do
168
168
  it {should be_a(Hash)}
169
169
  {
170
170
  "@id" => "",
171
- "@type" => ["earl:Software", "doap:Project"],
171
+ "@type" => ["Software", "doap:Project"],
172
172
  'bibRef' => "[[TURTLE]]",
173
173
  'name' => "Turtle Test Results"
174
174
  }.each do |prop, value|
@@ -184,10 +184,10 @@ describe EarlReport do
184
184
  RDF::Graph.new << JSON::LD::Reader.new(subject.to_json, :base_uri => "http://example.com/report")
185
185
  end
186
186
 
187
- it "saves output" do
187
+ it "saves output as JSON-LD" do
188
188
  expect {
189
189
  File.open(File.expand_path("../test-files/results.jsonld", __FILE__), "w") do |f|
190
- f.write(subject.to_json)
190
+ f.write(subject.to_json(JSON::LD::JSON_STATE))
191
191
  end
192
192
  }.not_to raise_error
193
193
  end
@@ -213,215 +213,8 @@ describe EarlReport do
213
213
  end
214
214
  end
215
215
 
216
- it "raises error if manifest query returns no solutions" do
217
- earl.graph.clear!
218
- expect {earl.send(:json_hash)}.to raise_error(%r(no results found querying manifest))
219
- end
220
- end
221
-
222
- describe "#json_test_subject_info" do
223
- let(:json) {earl.send(:json_test_subject_info)}
224
- subject {json}
225
- it {should be_a(Array)}
226
- its(:length) {should == 1}
227
-
228
- context "test subject" do
229
- let(:ts) {json.first}
230
- {
231
- "@id" => "http://rubygems.org/gems/rdf-turtle",
232
- "@type" => %w(earl:TestSubject doap:Project),
233
- doapDesc: "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
234
- homepage: "http://ruby-rdf.github.com/rdf-turtle",
235
- language: "Ruby",
236
- name: "RDF::Turtle",
237
- }.each do |prop, value|
238
- specify(prop) {expect(ts[prop.to_s]).to eq value}
239
- end
240
-
241
- context "developer" do
242
- let(:dev) {ts['developer']}
243
- specify {expect(dev).to be_a(Array)}
244
- specify {expect(dev.first).to be_a(Hash)}
245
- {
246
- "@id" => "http://greggkellogg.net/foaf#me",
247
- "@type" => %(foaf:Person),
248
- "foaf:name" => "Gregg Kellogg",
249
- }.each do |prop, value|
250
- specify(prop) {expect(dev.first[prop.to_s]).to eq value}
251
- end
252
- end
253
- end
254
- end
255
-
256
- describe "#json_result_info" do
257
- let(:json) {earl.send(:json_result_info)}
258
- subject {json}
259
- it {should be_a(Array)}
260
- its(:length) {should == 1}
261
-
262
- context 'entries' do
263
- let(:ts) {json.first}
264
- {
265
- "@id" => "http://example/manifest.ttl",
266
- "@type" => %w(earl:Report mf:Manifest),
267
- title: "Example Test Cases"
268
- }.each do |prop, value|
269
- specify(prop) {expect(ts[prop.to_s]).to eq value}
270
- end
271
-
272
- it "should have two entries" do
273
- expect(ts['entries'].length).to eq 2
274
- end
275
-
276
- context "test case" do
277
- let(:tc) {ts['entries'].first}
278
- {
279
- "@id" => "http://example/manifest.ttl#testeval00",
280
- "@type" => %w(earl:TestCriterion earl:TestCase http://www.w3.org/ns/rdftest#TestTurtleEval),
281
- title: "subm-test-00",
282
- description: "Blank subject",
283
- testAction: "http://example/test-00.ttl",
284
- testResult: "http://example/test-00.out",
285
- }.each do |prop, value|
286
- specify(prop) {expect(tc[prop.to_s]).to eq value}
287
- end
288
-
289
- context('assertions') do
290
- specify { expect(tc['assertions']).to be_a(Array)}
291
- specify('has one entry') { expect(tc['assertions'].length).to eq 1}
292
- end
293
-
294
- context "assertion" do
295
- let(:as) {tc['assertions'].first}
296
- specify {expect(as).to be_a(Hash)}
297
- {
298
- "@type" => %(earl:Assertion),
299
- assertedBy: "http://greggkellogg.net/foaf#me",
300
- mode: "earl:automatic",
301
- subject: "http://rubygems.org/gems/rdf-turtle",
302
- test: "http://example/manifest.ttl#testeval00",
303
- }.each do |prop, value|
304
- specify(prop) {expect(as[prop.to_s]).to eq value}
305
- end
306
-
307
- context "result" do
308
- let(:rs) {as['result']}
309
- specify {expect(rs).to be_a(Hash)}
310
- {
311
- "@type" => %(earl:TestResult),
312
- outcome: "earl:passed",
313
- }.each do |prop, value|
314
- specify(prop) {expect(rs[prop.to_s]).to eq value}
315
- end
316
- end
317
- end
318
- end
319
- end
320
- end
321
-
322
- describe "#test_subject_turtle" do
323
- let(:desc) {{
324
- "@id" => "http://rubygems.org/gems/rdf-turtle",
325
- "@type" => %w(earl:TestSubject doap:Project),
326
- 'doapDesc' => "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
327
- 'homepage' => "http://ruby-rdf.github.com/rdf-turtle",
328
- 'language' => "Ruby",
329
- 'name' => "RDF::Turtle",
330
- 'developer' => {
331
- '@id' => "http://greggkellogg.net/foaf#me",
332
- '@type' => %w(foaf:Person earl:Assertor),
333
- 'foaf:name' => "Gregg Kellogg"
334
- }
335
- }}
336
- let(:ttl) {earl.send(:test_subject_turtle, desc)}
337
- subject {ttl}
338
-
339
- its(:length) {should > 0}
340
- specify {should match(/<#{desc['@id']}> a/)}
341
- specify {should match(/ a #{desc['@type'].join(', ')}\s*[;\.]$/)}
342
- specify {should match(/ doap:name "#{desc['name']}"\s*[;\.]$/)}
343
- specify {should match(/ doap:description "#{desc['doapDesc']}"@en\s*[;\.]$/)}
344
- specify {should match(/ doap:programming-language "#{desc['language']}"\s*[;\.]$/)}
345
- specify {should match(/ doap:developer <#{desc['developer']['@id']}>/)}
346
-
347
- context "developer" do
348
- let(:dev) {desc['developer']}
349
- specify {should match(/<#{dev['@id']}> a/)}
350
- specify {should match(/ a #{dev['@type'].join(', ')}\s*[;\.]$/)}
351
- specify {should match(/ foaf:name "#{dev['foaf:name']}"\s*[;\.]$/)}
352
- end
353
- end
354
-
355
- describe "#tc_turtle" do
356
- let(:tc) {{
357
- "@id" => "http://example/manifest.ttl#testeval00",
358
- "@type" => %w(earl:TestCriterion earl:TestCase),
359
- 'title' => "subm-test-00",
360
- 'description' => "Blank subject",
361
- 'testAction' => "http://example/test-00.ttl",
362
- 'testResult' => "http://example/test-00.out",
363
- 'assertions' => [{
364
- "@type" => %(earl:Assertion),
365
- 'assertedBy' =>"http://greggkellogg.net/foaf#me",
366
- 'mode' => "earl:automatic",
367
- 'subject' => "http://rubygems.org/gems/rdf-turtle",
368
- 'test' => "http://example/manifest.ttl#testeval00",
369
- 'result' => {
370
- "@type" => %(earl:TestResult),
371
- 'outcome' => "earl:passed",
372
- }
373
- }]
374
- }}
375
- let(:ttl) {earl.send(:tc_turtle, tc)}
376
- subject {ttl}
377
- its(:length) {should > 0}
378
- specify {should match(/<#{tc['@id']}> a/)}
379
- specify {should match(/ a #{tc['@type'].join(', ')}\s*[;\.]$/)}
380
- specify {should match(/ dc:title "#{tc['title']}"\s*[;\.]$/)}
381
- specify {should match(/ dc:description "#{tc['description']}"@en\s*[;\.]$/)}
382
- specify {should match(/ mf:action <#{tc['testAction']}>\s*[;\.]$/)}
383
- specify {should match(/ mf:result <#{tc['testResult']}>\s*[;\.]$/)}
384
- specify {should match(/ earl:assertions \(\s*\[ a earl:Assertion/m)}
385
- end
386
-
387
- describe "#as_turtle" do
388
- let(:as) {{
389
- "@type" => %w(earl:Assertion),
390
- 'assertedBy' => "http://greggkellogg.net/foaf#me",
391
- 'mode' => "earl:automatic",
392
- 'subject' => "http://rubygems.org/gems/rdf-turtle",
393
- 'test' => "http://example/manifest.ttl#testeval00",
394
- 'result' => {
395
- '@type' => 'earl:TestResult',
396
- 'outcome' => 'earl:passed'
397
- }
398
- }}
399
- let(:ttl) {earl.send(:as_turtle, as)}
400
- subject {ttl}
401
- its(:length) {should > 0}
402
- specify {should match(/ a #{as['@type'].join(', ')}\s*[;\.]$/)}
403
- specify {should match(/ earl:assertedBy <#{as['assertedBy']}>\s*[;\.]$/)}
404
- specify {should match(/ earl:test <#{as['test']}>\s*[;\.]$/)}
405
- specify {should match(/ earl:subject <#{as['subject']}>\s*[;\.]$/)}
406
- specify {should match(/ earl:mode #{as['mode']}\s*[;\.]$/)}
407
- specify {should match(/ earl:result \[ a #{as['result']['@type']}; earl:outcome #{as['result']['outcome']} \]\]/)}
408
- it "has type" do
409
- expect(ttl).to match(/ a #{as['@type'].join(', ')}\s*[;\.]$/)
410
- end
411
- it "has earl:assertedBy" do
412
- expect(ttl).to match(/ earl:assertedBy <#{as['assertedBy']}>\s*[;\.]$/)
413
- end
414
- it "has earl:test" do
415
- expect(ttl).to match(/ earl:test <#{as['test']}>\s*[;\.]$/)
416
- end
417
- it "has earl:subject" do
418
- expect(ttl).to match(/ earl:subject <#{as['subject']}>\s*[;\.]$/)
419
- end
420
- it "has earl:mode" do
421
- expect(ttl).to match(/ earl:mode #{as['mode']}\s*[;\.]$/)
422
- end
423
- it "has earl:result" do
424
- expect(ttl).to match(/ earl:result \[ a #{as['result']['@type']}; earl:outcome #{as['result']['outcome']} \]\]/)
216
+ it "raises error if manifest query returns no solutions", pending: "needs new test" do
217
+ fail
425
218
  end
426
219
  end
427
220
 
@@ -442,35 +235,26 @@ describe EarlReport do
442
235
  let(:as) {tc['assertions'].first}
443
236
 
444
237
  context "prefixes" do
445
- %w(dc doap earl foaf mf owl rdf rdfs xsd).each do |pfx|
238
+ %w(dc doap earl foaf mf rdf rdfs xsd).each do |pfx|
446
239
  specify {should match(/@prefix #{pfx}: </)}
447
240
  end
448
241
  end
449
242
 
450
243
  context "earl:Software" do
451
- specify {should match(/<> a earl:Software, doap:Project\s*[;\.]$/)}
244
+ specify {should match(/<> a earl:Software,\s+doap:Project\s*[;\.]$/m)}
452
245
  specify {should match(/ doap:name "#{json_hash['name']}"\s*[;\.]$/)}
453
246
  end
454
247
 
455
248
  context "Subject Definitions" do
456
- specify {should match(/<#{ts['@id']}> a #{ts['@type'].join(', ')}\s*[;\.]$/)}
249
+ specify {should match(/<#{ts['@id']}> a doap:Project,\s+earl:TestSubject,\s+earl:Software;$/m)}
457
250
  end
458
251
 
459
252
  context "Manifest Definitions" do
460
- specify {should match(/<#{tm['@id']}> a #{tm['@type'].join(', ')}\s*[;\.]$/)}
461
- end
462
-
463
- context "Test Case Definitions" do
464
- let(:types) {
465
- tc['@type'].map do |t|
466
- t.include?("://") ? "<#{t}>" : t
467
- end
468
- }
469
- specify {should match(/<#{tc['@id']}> a #{types.join(', ')}\s*[;\.]$/)}
253
+ specify {should match(/<#{tm['@id']}> a mf:Manifest,\s+earl:Report\s*[;\.]$/m)}
470
254
  end
471
255
 
472
256
  context "Assertion" do
473
- specify {should match(/\[ a #{as['@type']}\s*[;\.]$/)}
257
+ specify {should match(/\sa earl:Assertion;$/)}
474
258
  end
475
259
 
476
260
  context "parsing to RDF" do
@@ -509,7 +293,7 @@ describe EarlReport do
509
293
  end
510
294
  end
511
295
  end
512
-
296
+
513
297
  describe "#generate" do
514
298
  let(:output) {
515
299
  @output ||= begin
@@ -524,7 +308,7 @@ describe EarlReport do
524
308
  end
525
309
  end
526
310
 
527
- it "saves output" do
311
+ it "saves output as HTML" do
528
312
  expect {
529
313
  File.open(File.expand_path("../test-files/results.html", __FILE__), "w") do |f|
530
314
  f.write(output)
@@ -566,11 +350,11 @@ describe EarlReport do
566
350
  dc:bibliographicCitation "[[TURTLE]]";
567
351
  earl:generatedBy ?generatedBy;
568
352
  earl:assertions ?assertionFile;
569
- earl:testSubjects (<http://rubygems.org/gems/rdf-turtle>);
353
+ earl:testSubjects <http://rubygems.org/gems/rdf-turtle>;
570
354
  mf:entries (<http://example/manifest.ttl>) .
571
355
 
572
356
  <http://example/manifest.ttl> a earl:Report, mf:Manifest;
573
- dc:title "Example Test Cases";
357
+ mf:name "Example Test Cases";
574
358
  mf:entries (
575
359
  <http://example/manifest.ttl#testeval00>
576
360
  ?test01
@@ -608,13 +392,10 @@ describe EarlReport do
608
392
 
609
393
  ASK WHERE {
610
394
  <http://example/manifest.ttl#testeval00> a earl:TestCriterion, earl:TestCase;
611
- dc:title "subm-test-00";
612
- dc:description """Blank subject"""@en;
395
+ mf:name "subm-test-00";
613
396
  mf:action <http://example/test-00.ttl>;
614
397
  mf:result <http://example/test-00.out>;
615
- earl:assertions (
616
- [ a earl:Assertion; earl:subject <http://rubygems.org/gems/rdf-turtle> ]
617
- ) .
398
+ earl:assertions [ a earl:Assertion; earl:subject <http://rubygems.org/gems/rdf-turtle> ] .
618
399
  }
619
400
  )
620
401