earl-report 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +37 -37
- data/VERSION +1 -1
- data/bin/earl-report +29 -1
- data/lib/earl_report.rb +208 -164
- data/spec/earl_report_spec.rb +293 -68
- data/spec/test-files/foaf.ttl +3 -0
- data/spec/test-files/results.html +98 -60
- data/spec/test-files/results.jsonld +72 -44
- data/spec/test-files/results.ttl +23 -13
- metadata +2 -2
data/spec/earl_report_spec.rb
CHANGED
@@ -5,23 +5,64 @@ require 'spec_helper'
|
|
5
5
|
describe EarlReport do
|
6
6
|
subject {
|
7
7
|
EarlReport.new(
|
8
|
-
File.expand_path("../test-files/manifest.ttl", __FILE__),
|
9
8
|
File.expand_path("../test-files/report-complete.ttl", __FILE__),
|
10
|
-
:
|
9
|
+
:bibRef => "[[TURTLE]]",
|
10
|
+
:name => "Turtle Test Results",
|
11
|
+
:verbose => false,
|
12
|
+
:manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
|
11
13
|
}
|
12
14
|
|
13
15
|
describe ".new" do
|
16
|
+
let(:manifest) {
|
17
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/manifest.ttl", __FILE__))
|
18
|
+
}
|
19
|
+
let(:reportComplete) {
|
20
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/report-complete.ttl", __FILE__))
|
21
|
+
}
|
22
|
+
let(:reportNoDoap) {
|
23
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/report-no-doap.ttl", __FILE__))
|
24
|
+
}
|
25
|
+
let(:reportNoFoaf) {
|
26
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/report-no-foaf.ttl", __FILE__))
|
27
|
+
}
|
28
|
+
let(:doap) {
|
29
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/doap.ttl", __FILE__))
|
30
|
+
}
|
31
|
+
let(:foaf) {
|
32
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/foaf.ttl", __FILE__))
|
33
|
+
}
|
34
|
+
|
35
|
+
it "requires a :manifest option" do
|
36
|
+
lambda {EarlReport.new}.should raise_error("Test Manifest must be specified with :manifest option")
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with base" do
|
40
|
+
it "loads manifest relative to base" do
|
41
|
+
RDF::Graph.should_receive(:load)
|
42
|
+
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {:base_uri => "http://example.com/base/"})
|
43
|
+
.and_return(manifest)
|
44
|
+
EarlReport.new(
|
45
|
+
:verbose => false,
|
46
|
+
:base => "http://example.com/base/",
|
47
|
+
:manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
14
51
|
context "complete report" do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
52
|
+
before(:each) do
|
53
|
+
RDF::Graph.should_receive(:load)
|
54
|
+
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
|
55
|
+
.and_return(manifest)
|
56
|
+
RDF::Graph.should_receive(:load)
|
57
|
+
.with(File.expand_path("../test-files/report-complete.ttl", __FILE__))
|
58
|
+
.and_return(reportComplete)
|
59
|
+
end
|
19
60
|
|
20
61
|
subject {
|
21
62
|
EarlReport.new(
|
22
|
-
File.expand_path("../test-files/manifest.ttl", __FILE__),
|
23
63
|
File.expand_path("../test-files/report-complete.ttl", __FILE__),
|
24
|
-
:verbose => false
|
64
|
+
:verbose => false,
|
65
|
+
:manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
|
25
66
|
}
|
26
67
|
it "loads manifest" do
|
27
68
|
subject.graph.subjects.to_a.should include(RDF::URI("http://example/manifest.ttl"))
|
@@ -42,16 +83,23 @@ describe EarlReport do
|
|
42
83
|
end
|
43
84
|
|
44
85
|
context "no doap report" do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
86
|
+
before(:each) do
|
87
|
+
RDF::Graph.should_receive(:load)
|
88
|
+
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
|
89
|
+
.and_return(manifest)
|
90
|
+
RDF::Graph.should_receive(:load)
|
91
|
+
.with(File.expand_path("../test-files/report-no-doap.ttl", __FILE__))
|
92
|
+
.and_return(reportNoDoap)
|
93
|
+
RDF::Graph.should_receive(:load)
|
94
|
+
.with("http://rubygems.org/gems/rdf-turtle")
|
95
|
+
.and_return(doap)
|
96
|
+
end
|
49
97
|
|
50
98
|
subject {
|
51
99
|
EarlReport.new(
|
52
|
-
File.expand_path("../test-files/manifest.ttl", __FILE__),
|
53
100
|
File.expand_path("../test-files/report-no-doap.ttl", __FILE__),
|
54
|
-
:verbose => false
|
101
|
+
:verbose => false,
|
102
|
+
:manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
|
55
103
|
}
|
56
104
|
it "loads manifest" do
|
57
105
|
subject.graph.subjects.to_a.should include(RDF::URI("http://example/manifest.ttl"))
|
@@ -62,8 +110,8 @@ describe EarlReport do
|
|
62
110
|
subject.graph.predicates.to_a.should include(RDF::URI("http://www.w3.org/ns/earl#assertedBy"))
|
63
111
|
end
|
64
112
|
|
65
|
-
it "
|
66
|
-
subject.graph.subjects.to_a.
|
113
|
+
it "loads doap" do
|
114
|
+
subject.graph.subjects.to_a.should include(RDF::URI("http://rubygems.org/gems/rdf-turtle"))
|
67
115
|
end
|
68
116
|
|
69
117
|
it "loads foaf" do
|
@@ -72,16 +120,23 @@ describe EarlReport do
|
|
72
120
|
end
|
73
121
|
|
74
122
|
context "no foaf report" do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
123
|
+
before(:each) do
|
124
|
+
RDF::Graph.should_receive(:load)
|
125
|
+
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
|
126
|
+
.and_return(manifest)
|
127
|
+
RDF::Graph.should_receive(:load)
|
128
|
+
.with(File.expand_path("../test-files/report-no-foaf.ttl", __FILE__))
|
129
|
+
.and_return(reportNoFoaf)
|
130
|
+
RDF::Graph.should_receive(:load)
|
131
|
+
.with("http://greggkellogg.net/foaf#me")
|
132
|
+
.and_return(foaf)
|
133
|
+
end
|
79
134
|
|
80
135
|
subject {
|
81
136
|
EarlReport.new(
|
82
|
-
File.expand_path("../test-files/manifest.ttl", __FILE__),
|
83
137
|
File.expand_path("../test-files/report-no-foaf.ttl", __FILE__),
|
84
|
-
:verbose => false
|
138
|
+
:verbose => false,
|
139
|
+
:manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
|
85
140
|
}
|
86
141
|
it "loads manifest" do
|
87
142
|
subject.graph.subjects.to_a.should include(RDF::URI("http://example/manifest.ttl"))
|
@@ -102,15 +157,9 @@ describe EarlReport do
|
|
102
157
|
end
|
103
158
|
end
|
104
159
|
|
105
|
-
describe ".generate" do
|
106
|
-
end
|
107
|
-
|
108
160
|
describe "#json_hash" do
|
109
161
|
let(:json) {
|
110
|
-
subject.send(:json_hash
|
111
|
-
bibRef: "[[TURTLE]]",
|
112
|
-
name: "Turtle Test Results"
|
113
|
-
})
|
162
|
+
subject.send(:json_hash)
|
114
163
|
}
|
115
164
|
specify {json.should be_a(Hash)}
|
116
165
|
{
|
@@ -122,12 +171,36 @@ describe EarlReport do
|
|
122
171
|
specify(prop) {json[prop].should == value}
|
123
172
|
end
|
124
173
|
|
125
|
-
|
126
|
-
json.keys.should include(
|
174
|
+
%w(assertions testSubjects tests).each do |key|
|
175
|
+
specify {json.keys.should include(key)}
|
127
176
|
end
|
128
177
|
|
129
|
-
|
130
|
-
|
178
|
+
context "parsing to RDF" do
|
179
|
+
let(:graph) do
|
180
|
+
@graph ||= begin
|
181
|
+
RDF::Graph.new << JSON::LD::Reader.new(json.to_json, :base_uri => "http://example.com/report")
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
it "has Report" do
|
186
|
+
SPARQL.execute(REPORT_QUERY, graph).should == RDF::Literal::TRUE
|
187
|
+
end
|
188
|
+
|
189
|
+
it "has Subject" do
|
190
|
+
SPARQL.execute(SUBJECT_QUERY, graph).should == RDF::Literal::TRUE
|
191
|
+
end
|
192
|
+
|
193
|
+
it "has Developer" do
|
194
|
+
SPARQL.execute(DEVELOPER_QUERY, graph).should == RDF::Literal::TRUE
|
195
|
+
end
|
196
|
+
|
197
|
+
it "has Test Case" do
|
198
|
+
SPARQL.execute(TC_QUERY, graph).should == RDF::Literal::TRUE
|
199
|
+
end
|
200
|
+
|
201
|
+
it "has Assertion" do
|
202
|
+
SPARQL.execute(ASSERTION_QUERY, graph).should be_true
|
203
|
+
end
|
131
204
|
end
|
132
205
|
end
|
133
206
|
|
@@ -141,7 +214,7 @@ describe EarlReport do
|
|
141
214
|
{
|
142
215
|
"@id" => "http://rubygems.org/gems/rdf-turtle",
|
143
216
|
"@type" => %w(earl:TestSubject doap:Project),
|
144
|
-
|
217
|
+
doapDesc: "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
|
145
218
|
homepage: "http://ruby-rdf.github.com/rdf-turtle",
|
146
219
|
language: "Ruby",
|
147
220
|
name: "RDF::Turtle",
|
@@ -151,13 +224,14 @@ describe EarlReport do
|
|
151
224
|
|
152
225
|
context "developer" do
|
153
226
|
let(:dev) {ts['developer']}
|
154
|
-
specify {dev.should be_a(
|
227
|
+
specify {dev.should be_a(Array)}
|
228
|
+
specify {dev.first.should be_a(Hash)}
|
155
229
|
{
|
156
230
|
"@id" => "http://greggkellogg.net/foaf#me",
|
157
231
|
"@type" => %(foaf:Person),
|
158
232
|
"foaf:name" => "Gregg Kellogg",
|
159
233
|
}.each do |prop, value|
|
160
|
-
specify(prop) {dev[prop.to_s].should == value}
|
234
|
+
specify(prop) {dev.first[prop.to_s].should == value}
|
161
235
|
end
|
162
236
|
end
|
163
237
|
end
|
@@ -181,8 +255,13 @@ describe EarlReport do
|
|
181
255
|
specify(prop) {tc[prop.to_s].should == value}
|
182
256
|
end
|
183
257
|
|
258
|
+
context('assertions') do
|
259
|
+
specify { tc['assertions'].should be_a(Array)}
|
260
|
+
specify('has one entry') { tc['assertions'].length.should == 1}
|
261
|
+
end
|
262
|
+
|
184
263
|
context "assertion" do
|
185
|
-
let(:as) {tc['
|
264
|
+
let(:as) {tc['assertions'].first}
|
186
265
|
specify {as.should be_a(Hash)}
|
187
266
|
{
|
188
267
|
"@type" => %(earl:Assertion),
|
@@ -208,13 +287,12 @@ describe EarlReport do
|
|
208
287
|
end
|
209
288
|
end
|
210
289
|
|
211
|
-
|
212
290
|
describe "#test_subject_turtle" do
|
213
291
|
context "test subject" do
|
214
292
|
let(:desc) {{
|
215
293
|
"@id" => "http://rubygems.org/gems/rdf-turtle",
|
216
294
|
"@type" => %w(earl:TestSubject doap:Project),
|
217
|
-
'
|
295
|
+
'doapDesc' => "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
|
218
296
|
'homepage' => "http://ruby-rdf.github.com/rdf-turtle",
|
219
297
|
'language' => "Ruby",
|
220
298
|
'name' => "RDF::Turtle",
|
@@ -230,16 +308,16 @@ describe EarlReport do
|
|
230
308
|
ttl.should match(/<#{desc['@id']}> a/)
|
231
309
|
end
|
232
310
|
it "has types" do
|
233
|
-
ttl.should match(/ a #{desc['@type'].join(', ')}
|
311
|
+
ttl.should match(/ a #{desc['@type'].join(', ')}\s*[;\.]$/)
|
234
312
|
end
|
235
313
|
it "has name" do
|
236
|
-
ttl.should match(/ doap:name "#{desc['name']}"
|
314
|
+
ttl.should match(/ doap:name "#{desc['name']}"\s*[;\.]$/)
|
237
315
|
end
|
238
316
|
it "has description" do
|
239
|
-
ttl.should match(/ doap:description """#{desc['
|
317
|
+
ttl.should match(/ doap:description """#{desc['doapDesc']}"""\s*[;\.]$/)
|
240
318
|
end
|
241
319
|
it "has doap:programming-language" do
|
242
|
-
ttl.should match(/ doap:programming-language "#{desc['language']}"
|
320
|
+
ttl.should match(/ doap:programming-language "#{desc['language']}"\s*[;\.]$/)
|
243
321
|
end
|
244
322
|
it "has doap:developer" do
|
245
323
|
ttl.should match(/ doap:developer <#{desc['developer']['@id']}>/)
|
@@ -251,10 +329,10 @@ describe EarlReport do
|
|
251
329
|
ttl.should match(/<#{dev['@id']}> a/)
|
252
330
|
end
|
253
331
|
it "has types" do
|
254
|
-
ttl.should match(/ a #{dev['@type'].join(', ')}
|
332
|
+
ttl.should match(/ a #{dev['@type'].join(', ')}\s*[;\.]$/)
|
255
333
|
end
|
256
334
|
it "has name" do
|
257
|
-
ttl.should match(/ foaf:name "#{dev['foaf:name']}"
|
335
|
+
ttl.should match(/ foaf:name "#{dev['foaf:name']}"\s*[;\.]$/)
|
258
336
|
end
|
259
337
|
end
|
260
338
|
end
|
@@ -269,6 +347,17 @@ describe EarlReport do
|
|
269
347
|
'description' => "Blank subject",
|
270
348
|
'testAction' => "http://example/test-00.ttl",
|
271
349
|
'testResult' => "http://example/test-00.out",
|
350
|
+
'assertions' => [{
|
351
|
+
"@type" => %(earl:Assertion),
|
352
|
+
'assertedBy' =>"http://greggkellogg.net/foaf#me",
|
353
|
+
'mode' => "earl:automatic",
|
354
|
+
'subject' => "http://rubygems.org/gems/rdf-turtle",
|
355
|
+
'test' => "http://example/manifest.ttl#testeval00",
|
356
|
+
'result' => {
|
357
|
+
"@type" => %(earl:TestResult),
|
358
|
+
'outcome' => "earl:passed",
|
359
|
+
}
|
360
|
+
}]
|
272
361
|
}}
|
273
362
|
let(:ttl) {subject.send(:tc_turtle, tc)}
|
274
363
|
specify {ttl.length.should > 0}
|
@@ -276,19 +365,22 @@ describe EarlReport do
|
|
276
365
|
ttl.should match(/<#{tc['@id']}> a/)
|
277
366
|
end
|
278
367
|
it "has types" do
|
279
|
-
ttl.should match(/ a #{tc['@type'].join(', ')}
|
368
|
+
ttl.should match(/ a #{tc['@type'].join(', ')}\s*[;\.]$/)
|
280
369
|
end
|
281
370
|
it "has dc:title" do
|
282
|
-
ttl.should match(/ dc:title "#{tc['title']}"
|
371
|
+
ttl.should match(/ dc:title "#{tc['title']}"\s*[;\.]$/)
|
283
372
|
end
|
284
373
|
it "has dc:description" do
|
285
|
-
ttl.should match(/ dc:description """#{tc['description']}"""
|
374
|
+
ttl.should match(/ dc:description """#{tc['description']}"""\s*[;\.]$/)
|
286
375
|
end
|
287
376
|
it "has mf:action" do
|
288
|
-
ttl.should match(/ mf:action <#{tc['testAction']}
|
377
|
+
ttl.should match(/ mf:action <#{tc['testAction']}>\s*[;\.]$/)
|
289
378
|
end
|
290
379
|
it "has mf:result" do
|
291
|
-
ttl.should match(/ mf:result <#{tc['testResult']}
|
380
|
+
ttl.should match(/ mf:result <#{tc['testResult']}>\s*[;\.]$/)
|
381
|
+
end
|
382
|
+
it "has earl:assertions" do
|
383
|
+
ttl.should match(/ earl:assertions \(\s*\[ a earl:Assertion/m)
|
292
384
|
end
|
293
385
|
end
|
294
386
|
end
|
@@ -309,41 +401,39 @@ describe EarlReport do
|
|
309
401
|
let(:ttl) {subject.send(:as_turtle, as)}
|
310
402
|
specify {ttl.length.should > 0}
|
311
403
|
it "has type" do
|
312
|
-
ttl.should match(/ a #{as['@type'].join(', ')}
|
404
|
+
ttl.should match(/ a #{as['@type'].join(', ')}\s*[;\.]$/)
|
313
405
|
end
|
314
406
|
it "has earl:assertedBy" do
|
315
|
-
ttl.should match(/ earl:assertedBy <#{as['assertedBy']}
|
407
|
+
ttl.should match(/ earl:assertedBy <#{as['assertedBy']}>\s*[;\.]$/)
|
316
408
|
end
|
317
409
|
it "has earl:test" do
|
318
|
-
ttl.should match(/ earl:test <#{as['test']}
|
410
|
+
ttl.should match(/ earl:test <#{as['test']}>\s*[;\.]$/)
|
319
411
|
end
|
320
412
|
it "has earl:subject" do
|
321
|
-
ttl.should match(/ earl:subject <#{as['subject']}
|
413
|
+
ttl.should match(/ earl:subject <#{as['subject']}>\s*[;\.]$/)
|
322
414
|
end
|
323
415
|
it "has earl:mode" do
|
324
|
-
ttl.should match(/ earl:mode #{as['mode']}
|
416
|
+
ttl.should match(/ earl:mode #{as['mode']}\s*[;\.]$/)
|
325
417
|
end
|
326
418
|
it "has earl:result" do
|
327
|
-
ttl.should match(/ earl:result \[ a #{as['result']['@type']}; earl:outcome #{as['result']['outcome']}\]/)
|
419
|
+
ttl.should match(/ earl:result \[ a #{as['result']['@type']}; earl:outcome #{as['result']['outcome']} \]\]/)
|
328
420
|
end
|
329
421
|
end
|
330
422
|
end
|
331
423
|
|
332
424
|
describe "#earl_turtle" do
|
333
|
-
let(:
|
334
|
-
@results ||= JSON.parse(File.read(File.expand_path("../test-files/results.jsonld", __FILE__)))
|
335
|
-
}
|
425
|
+
let(:json_hash) {subject.send(:json_hash)}
|
336
426
|
let(:output) {
|
337
427
|
@output ||= begin
|
338
428
|
sio = StringIO.new
|
339
|
-
subject.send(:earl_turtle, {
|
429
|
+
subject.send(:earl_turtle, {io: sio})
|
340
430
|
sio.rewind
|
341
431
|
sio.read
|
342
432
|
end
|
343
433
|
}
|
344
|
-
let(:ts) {
|
345
|
-
let(:tc) {
|
346
|
-
let(:as) {tc[
|
434
|
+
let(:ts) {json_hash['testSubjects'].first}
|
435
|
+
let(:tc) {json_hash['tests'].first}
|
436
|
+
let(:as) {tc['assertions'].first}
|
347
437
|
|
348
438
|
context "prefixes" do
|
349
439
|
%w(dc doap earl foaf mf owl rdf rdfs xsd).each do |pfx|
|
@@ -354,20 +444,155 @@ describe EarlReport do
|
|
354
444
|
end
|
355
445
|
|
356
446
|
context "earl:Software" do
|
357
|
-
specify {output.should match(/<> a earl:Software, doap:Project
|
358
|
-
specify {output.should match(/ doap:name "#{
|
447
|
+
specify {output.should match(/<> a earl:Software, doap:Project\s*[;\.]$/)}
|
448
|
+
specify {output.should match(/ doap:name "#{json_hash['name']}"\s*[;\.]$/)}
|
359
449
|
end
|
360
450
|
|
361
451
|
context "Subject Definitions" do
|
362
|
-
specify {output.should match(/<#{ts['@id']}> a #{ts['@type'].join(', ')}
|
452
|
+
specify {output.should match(/<#{ts['@id']}> a #{ts['@type'].join(', ')}\s*[;\.]$/)}
|
363
453
|
end
|
364
454
|
|
365
455
|
context "Test Case Definitions" do
|
366
|
-
specify {output.should match(/<#{tc['@id']}> a #{tc['@type'].join(', ')}
|
456
|
+
specify {output.should match(/<#{tc['@id']}> a #{tc['@type'].join(', ')}\s*[;\.]$/)}
|
367
457
|
end
|
368
458
|
|
369
459
|
context "Assertion" do
|
370
|
-
specify {output.should match(/\[ a #{as['@type']}
|
460
|
+
specify {output.should match(/\[ a #{as['@type']}\s*[;\.]$/)}
|
461
|
+
end
|
462
|
+
|
463
|
+
context "parsing to RDF" do
|
464
|
+
let(:graph) do
|
465
|
+
@graph ||= begin
|
466
|
+
RDF::Graph.new << RDF::Turtle::Reader.new(output, :base_uri => "http://example.com/report")
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
it "has Report" do
|
471
|
+
SPARQL.execute(REPORT_QUERY, graph).should == RDF::Literal::TRUE
|
472
|
+
end
|
473
|
+
|
474
|
+
it "has Subject" do
|
475
|
+
SPARQL.execute(SUBJECT_QUERY, graph).should == RDF::Literal::TRUE
|
476
|
+
end
|
477
|
+
|
478
|
+
it "has Developer" do
|
479
|
+
SPARQL.execute(DEVELOPER_QUERY, graph).should == RDF::Literal::TRUE
|
480
|
+
end
|
481
|
+
|
482
|
+
it "has Test Case" do
|
483
|
+
SPARQL.execute(TC_QUERY, graph).should == RDF::Literal::TRUE
|
484
|
+
end
|
485
|
+
|
486
|
+
it "has Assertion" do
|
487
|
+
SPARQL.execute(ASSERTION_QUERY, graph).should be_true
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
describe "#generate" do
|
493
|
+
let(:output) {
|
494
|
+
@output ||= begin
|
495
|
+
subject.generate()
|
496
|
+
end
|
497
|
+
}
|
498
|
+
|
499
|
+
context "parsing to RDF" do
|
500
|
+
let(:graph) do
|
501
|
+
@graph ||= begin
|
502
|
+
RDF::Graph.new << RDF::RDFa::Reader.new(output, :base_uri => "http://example.com/report")
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
it "has Report" do
|
507
|
+
SPARQL.execute(REPORT_QUERY, graph).should == RDF::Literal::TRUE
|
508
|
+
end
|
509
|
+
|
510
|
+
it "has Subject" do
|
511
|
+
SPARQL.execute(SUBJECT_QUERY, graph).should == RDF::Literal::TRUE
|
512
|
+
end
|
513
|
+
|
514
|
+
it "has Developer" do
|
515
|
+
SPARQL.execute(DEVELOPER_QUERY, graph).should == RDF::Literal::TRUE
|
516
|
+
end
|
517
|
+
|
518
|
+
it "has Test Case" do
|
519
|
+
SPARQL.execute(TC_QUERY, graph).should == RDF::Literal::TRUE
|
520
|
+
end
|
521
|
+
|
522
|
+
it "has Assertion" do
|
523
|
+
SPARQL.execute(ASSERTION_QUERY, graph).should be_true
|
524
|
+
end
|
371
525
|
end
|
372
526
|
end
|
527
|
+
|
528
|
+
REPORT_QUERY = %(
|
529
|
+
PREFIX dc: <http://purl.org/dc/terms/>
|
530
|
+
PREFIX doap: <http://usefulinc.com/ns/doap#>
|
531
|
+
PREFIX earl: <http://www.w3.org/ns/earl#>
|
532
|
+
|
533
|
+
ASK WHERE {
|
534
|
+
?uri a earl:Software, doap:Project;
|
535
|
+
doap:name "Turtle Test Results";
|
536
|
+
dc:bibliographicCitation "[[TURTLE]]";
|
537
|
+
earl:assertions ?assertionFile;
|
538
|
+
earl:testSubjects (<http://rubygems.org/gems/rdf-turtle>);
|
539
|
+
earl:tests (
|
540
|
+
<http://example/manifest.ttl#testeval00>
|
541
|
+
?test01
|
542
|
+
) .
|
543
|
+
}
|
544
|
+
)
|
545
|
+
|
546
|
+
SUBJECT_QUERY = %(
|
547
|
+
PREFIX doap: <http://usefulinc.com/ns/doap#>
|
548
|
+
PREFIX earl: <http://www.w3.org/ns/earl#>
|
549
|
+
|
550
|
+
ASK WHERE {
|
551
|
+
<http://rubygems.org/gems/rdf-turtle> a earl:TestSubject, doap:Project;
|
552
|
+
doap:name "RDF::Turtle";
|
553
|
+
doap:description """RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.""";
|
554
|
+
doap:programming-language "Ruby";
|
555
|
+
doap:developer <http://greggkellogg.net/foaf#me> .
|
556
|
+
}
|
557
|
+
)
|
558
|
+
|
559
|
+
DEVELOPER_QUERY = %(
|
560
|
+
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
561
|
+
|
562
|
+
ASK WHERE {
|
563
|
+
<http://greggkellogg.net/foaf#me> a foaf:Person;
|
564
|
+
foaf:name "Gregg Kellogg";
|
565
|
+
foaf:homepage <http://greggkellogg.net/> .
|
566
|
+
}
|
567
|
+
)
|
568
|
+
|
569
|
+
TC_QUERY = %(
|
570
|
+
PREFIX dc: <http://purl.org/dc/terms/>
|
571
|
+
PREFIX earl: <http://www.w3.org/ns/earl#>
|
572
|
+
PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>
|
573
|
+
|
574
|
+
ASK WHERE {
|
575
|
+
<http://example/manifest.ttl#testeval00> a earl:TestCriterion, earl:TestCase;
|
576
|
+
dc:title "subm-test-00";
|
577
|
+
dc:description """Blank subject""";
|
578
|
+
mf:action <http://example/test-00.ttl>;
|
579
|
+
mf:result <http://example/test-00.out>;
|
580
|
+
earl:assertions (
|
581
|
+
[ a earl:Assertion; earl:subject <http://rubygems.org/gems/rdf-turtle> ]
|
582
|
+
) .
|
583
|
+
}
|
584
|
+
)
|
585
|
+
|
586
|
+
ASSERTION_QUERY = %(
|
587
|
+
PREFIX earl: <http://www.w3.org/ns/earl#>
|
588
|
+
|
589
|
+
ASK WHERE {
|
590
|
+
[ a earl:Assertion;
|
591
|
+
earl:assertedBy <http://greggkellogg.net/foaf#me>;
|
592
|
+
earl:test <http://example/manifest.ttl#testeval00>;
|
593
|
+
earl:subject <http://rubygems.org/gems/rdf-turtle>;
|
594
|
+
earl:mode earl:automatic;
|
595
|
+
earl:result [ a earl:TestResult; earl:outcome earl:passed] ] .
|
596
|
+
}
|
597
|
+
)
|
373
598
|
end
|