rdf-vocab 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/matchers.rb CHANGED
@@ -26,3 +26,30 @@ RSpec::Matchers.define :match_json_path do |path|
26
26
  "\nActual: #{actual.to_json(JSON::LD::JSON_STATE)}"
27
27
  end
28
28
  end
29
+
30
+ RSpec::Matchers.define :have_errors do |errors|
31
+ match do |actual|
32
+ return false unless actual.keys == errors.keys
33
+ actual.each do |area_key, area_values|
34
+ return false unless area_values.length == errors[area_key].length
35
+ area_values.each do |term, values|
36
+ return false unless values.length == errors[area_key][term].length
37
+ values.each_with_index do |v, i|
38
+ return false unless case m = errors[area_key][term][i]
39
+ when Regexp then m.match v
40
+ else m == v
41
+ end
42
+ end
43
+ end
44
+ end
45
+ true
46
+ end
47
+
48
+ failure_message do |actual|
49
+ "expected errors to match #{errors.to_json(JSON::LD::JSON_STATE)}\nwas #{actual.to_json(JSON::LD::JSON_STATE)}"
50
+ end
51
+
52
+ failure_message_when_negated do |actual|
53
+ "expected errors not to match #{errors.to_json(JSON::LD::JSON_STATE)}"
54
+ end
55
+ end
data/spec/vocab_spec.rb CHANGED
@@ -3,6 +3,9 @@ require File.expand_path("../spec_helper", __FILE__)
3
3
  require 'rdf/reasoner'
4
4
 
5
5
  describe RDF::Vocab do
6
+ before(:all) {
7
+ RDF::Reasoner.apply(:rdfs, :owl)
8
+ }
6
9
  describe ".each" do
7
10
  it "enumerates pre-defined vocabularies" do
8
11
  expect {|b| RDF::Vocabulary.each(&b)}.to yield_control.at_least(RDF::Vocab::VOCABS.keys.length).times
@@ -15,6 +18,25 @@ describe RDF::Vocab do
15
18
  expect {RDF::Vocab::SCHEMA[prop]}.not_to raise_error
16
19
  end
17
20
  end
21
+
22
+ context "detects superseded terms" do
23
+ {
24
+ "members superseded by member" => [
25
+ %(
26
+ @prefix schema: <http://schema.org/> .
27
+ <foo> a schema:Organization; schema:members "Manny" .
28
+ ),
29
+ {
30
+ property: {"schema:members" => ["Term is superseded by schema:member"]},
31
+ }
32
+ ],
33
+ }.each do |name, (input, errors)|
34
+ it name do
35
+ graph = RDF::Graph.new << RDF::Turtle::Reader.new(input)
36
+ expect(graph.lint).to have_errors errors
37
+ end
38
+ end
39
+ end
18
40
  end
19
41
 
20
42
  context "pre-defined vocabularies" do
@@ -41,9 +63,6 @@ describe RDF::Vocab do
41
63
  end
42
64
 
43
65
  context "entailments" do
44
- before(:all) {
45
- RDF::Reasoner.apply(:rdfs, :owl)
46
- }
47
66
  RDF::Vocabulary.each do |vocab|
48
67
  vocab.each do |term|
49
68
  if term.type.to_s =~ /Class/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-vocab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chandek-Stark
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-28 00:00:00.000000000 Z
13
+ date: 2016-08-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '2.0'
21
+ version: '2.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '2.0'
28
+ version: '2.1'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: haml
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -329,7 +329,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
329
329
  requirements:
330
330
  - - ">="
331
331
  - !ruby/object:Gem::Version
332
- version: '2.0'
332
+ version: 2.2.2
333
333
  required_rubygems_version: !ruby/object:Gem::Requirement
334
334
  requirements:
335
335
  - - ">="
@@ -346,4 +346,3 @@ test_files:
346
346
  - spec/matchers.rb
347
347
  - spec/spec_helper.rb
348
348
  - spec/vocab_spec.rb
349
- has_rdoc: false