rdf-spec 1.1.0p4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDQwNmVjMTE1MDQ2YTljYWM5NjY1MjI0NzhlNjcwNDM5NzE2Nzg0Nw==
5
- data.tar.gz: !binary |-
6
- NGZlZWZhOGNiNmQyN2MyOThlZDI2MzhkYTBlNjc2MDMxNjdjMjkzNw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MDg5MGQ3MTlhMTVjODlmZThjN2VmM2Q0YzkyMDY0YzU0ZGU0YmM5ODRlZTFh
10
- MGIzMmY3MDUyOTFkNjgzMTE1ZDFjNDQwM2Q2ZDgyMzE0ODRmZWQxNDY1OTll
11
- NWIwYTJhZTQxYTJhNWRmYTI0OGRhYmYzMjRhOWNkODI0MWU1ZjE=
12
- data.tar.gz: !binary |-
13
- YjFiMjcxZGNlYjA2ZWI1MzZlZmU0MDhmMDlhYTcxYzkzNGIyMGJhOGFiOTc4
14
- N2I2M2RkOWFhOWU5OTI1MDE0NTk0YWQ2YzI5MWRhMzZhOGQ2YTQ2MjY0MDI0
15
- Y2ExYzk0YjFkOTAwZGRjMzJlMDEyMjQ4OTM1NzkzNTEzMDlkZDY=
2
+ SHA1:
3
+ metadata.gz: 55b304bd99801d0dff43b5fc240bb1d8feb1b3cf
4
+ data.tar.gz: d7513635a1111bf62e220aa65b7e5e46852a80d6
5
+ SHA512:
6
+ metadata.gz: bdd77291081628c58b77b65eb7b0bf293e8b2a077c24b0bca4a486a9322c78227fc6328b9a36c71c415ea68674fd8a0b743e838d1f15be2130389a85fa9a920f
7
+ data.tar.gz: 0bdb0547949d73aa6f49d8d471c7cbf1b8db89836683cb3b6fa23be9d46e6ee18737df1ea04da301d9dbd2be79d706c7076d5165b7fcf73b5c1d52927ec23874
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0p4
1
+ 1.1.0
@@ -29,14 +29,24 @@ module RDF_Enumerable
29
29
  it {should respond_to(:supports?)}
30
30
 
31
31
  describe "valid?" do
32
- it {should be_valid}
32
+ it "reports validity" do
33
+ if subject.supports?(:validity)
34
+ should be_valid
35
+ else
36
+ expect {subject.valid?}.to raise_error(NotImplementedError)
37
+ end
38
+ end
33
39
 
34
40
  it "returns false if any statement is invalid" do
35
41
  if subject.respond_to?(:<<) && (subject.writable? rescue true)
36
42
  s = RDF::Statement.from([nil, nil, nil])
37
- expect(s).not_to be_valid
38
- subject << s
39
- expect(subject).not_to be_valid
43
+ if subject.supports?(:validity)
44
+ expect(s).not_to be_valid
45
+ subject << s
46
+ expect(subject).not_to be_valid
47
+ else
48
+ expect {subject.valid?}.to raise_error(NotImplementedError)
49
+ end
40
50
  else
41
51
  pending("can't add statement to immutable enumerable")
42
52
  end
@@ -107,7 +117,11 @@ module RDF_Enumerable
107
117
  its(:enum_statement) {should be_queryable}
108
118
  context "#enum_statement" do
109
119
  it "should enumerate all statements" do
110
- expect(subject.enum_statement.to_a).to include(*@enumerable.each_statement.to_a)
120
+ expect(subject.enum_statement.count).to eq @enumerable.each_statement.count
121
+ subject.enum_statement.each do |s|
122
+ expect(s).to be_a_statement
123
+ expect(@enumerable.each_statement.to_a).to include(s) unless s.has_blank_nodes?
124
+ end
111
125
  end
112
126
  end
113
127
  end
@@ -135,13 +149,23 @@ module RDF_Enumerable
135
149
  its(:each_triple) {should be_an_enumerator}
136
150
  context "#each_triple" do
137
151
  specify {subject.each_triple { |*triple| expect(triple).to be_a_triple }}
152
+ it "should iterate over all triples" do
153
+ subject.each_triple do |*triple|
154
+ triple.each {|r| expect(r).to be_a_term}
155
+ expect(@enumerable).to have_triple(triple) unless triple.any?(&:node?)
156
+ end
157
+ end
138
158
  end
139
159
 
140
160
  its(:enum_triple) {should be_an_enumerator}
141
161
  its(:enum_triple) {should be_countable}
142
162
  context "#enum_triple" do
143
163
  it "should enumerate all triples" do
144
- expect(subject.enum_triple.to_a).to include(*@enumerable.each_triple.to_a)
164
+ expect(subject.enum_triple.count).to eq @enumerable.each_triple.count
165
+ subject.enum_triple.each do |s, p, o|
166
+ [s, p, o].each {|r| expect(r).to be_a_term}
167
+ expect(@enumerable).to have_triple([s, p, o]) unless [s, p, o].any?(&:node?)
168
+ end
145
169
  end
146
170
  end
147
171
  end
@@ -171,13 +195,23 @@ module RDF_Enumerable
171
195
  its(:each_quad) {should be_an_enumerator}
172
196
  context "#each_quad" do
173
197
  specify {subject.each_quad {|*quad| expect(quad).to be_a_quad }}
198
+ it "should iterate over all quads" do
199
+ subject.each_quad do |*quad|
200
+ quad.compact.each {|r| expect(r).to be_a_term}
201
+ expect(@enumerable).to have_quad(quad) unless quad.compact.any?(&:node?)
202
+ end
203
+ end
174
204
  end
175
205
 
176
206
  its(:enum_quad) {should be_an_enumerator}
177
207
  its(:enum_quad) {should be_countable}
178
208
  context "#enum_quad" do
179
209
  it "should enumerate all quads" do
180
- expect(subject.enum_quad.to_a).to include(*@enumerable.each_quad.to_a)
210
+ expect(subject.enum_quad.count).to eq @enumerable.each_quad.count
211
+ subject.enum_quad.each do |s, p, o, c|
212
+ [s, p, o, c].compact.each {|r| expect(r).to be_a_term}
213
+ expect(@enumerable).to have_quad([s, p, o, c]) unless [s, p, o].any?(&:node?)
214
+ end
181
215
  end
182
216
  end
183
217
  end
@@ -215,7 +249,7 @@ module RDF_Enumerable
215
249
 
216
250
  its(:each_subject) {should be_an_enumerator}
217
251
  context "#each_subject" do
218
- specify {expect(subject.each_subject.reject(&:node?).size).to eq subjects.size}
252
+ specify {expect(subject.each_subject.reject(&:node?).size).to eq subjects.reject(&:node?).size}
219
253
  specify {subject.each_subject {|value| expect(value).to be_a_resource}}
220
254
  specify {subject.each_subject {|value| expect(subjects).to include(value) unless value.node?}}
221
255
  end
@@ -223,8 +257,12 @@ module RDF_Enumerable
223
257
  its(:enum_subject) {should be_an_enumerator}
224
258
  its(:enum_subject) {should be_countable}
225
259
  context "#enum_subject" do
260
+ specify {expect(subject.enum_subject.to_a.reject(&:node?).size).to eq subjects.reject(&:node?).size}
226
261
  it "should enumerate all subjects" do
227
- expect(subject.enum_subject.reject(&:node?)).to include(*subjects)
262
+ subject.enum_subject.each do |s|
263
+ expect(s).to be_a_resource
264
+ expect(subjects.to_a).to include(s) unless s.node?
265
+ end
228
266
  end
229
267
  end
230
268
  end
@@ -318,7 +356,10 @@ module RDF_Enumerable
318
356
  its(:enum_object) {should be_countable}
319
357
  context "#enum_object" do
320
358
  it "should enumerate all objects" do
321
- expect(subject.enum_object.reject(&:node?)).to include(*objects)
359
+ subject.enum_object.each do |o|
360
+ expect(o).to be_a_term
361
+ expect(objects.to_a).to include(o) unless o.node?
362
+ end
322
363
  end
323
364
  end
324
365
  end
@@ -398,8 +439,8 @@ module RDF_Enumerable
398
439
  subject {@enumerable.enum_graph}
399
440
  it {should be_an_enumerator}
400
441
  it {should be_countable}
401
- it "enumerates the same as #each_graph" do
402
- subject.to_a.should =~ @enumerable.each_graph.to_a if @supports_context # expect with match problematic
442
+ it "enumerates the same as #each_graph", :pending => "graph inclusion issue" do
443
+ expect(subject.to_a).to include(*@enumerable.each_graph.to_a) if @supports_context # expect with match problematic
403
444
  end
404
445
  end
405
446
  end
@@ -22,7 +22,7 @@ module RDF; module Spec
22
22
 
23
23
  RSpec::Matchers.define :be_an_enumerator do
24
24
  match do |enumerator|
25
- expect(enumerator).to be_a_kind_of(::Enumerator)
25
+ expect(enumerator).to be_a_kind_of(Enumerator)
26
26
  true
27
27
  end
28
28
  end
@@ -74,6 +74,13 @@ module RDF; module Spec
74
74
  end
75
75
  end
76
76
 
77
+ RSpec::Matchers.define :be_a_term do
78
+ match do |value|
79
+ expect(value).to be_a_kind_of(RDF::Term)
80
+ true
81
+ end
82
+ end
83
+
77
84
  RSpec::Matchers.define :be_a_resource do
78
85
  match do |value|
79
86
  expect(value).to be_a_kind_of(RDF::Resource)
@@ -18,11 +18,11 @@ module RDF_Queryable
18
18
  end
19
19
  end
20
20
  end
21
- let(:resource) {RDF::URI('http://rubygems.org/gems/rdf')}
22
- let(:literal) {RDF::Literal.new('J. Random Hacker')}
23
21
 
24
22
  describe RDF::Queryable do
25
23
  subject {@queryable}
24
+ let(:resource) {RDF::URI('http://rubygems.org/gems/rdf')}
25
+ let(:literal) {RDF::Literal.new('J. Random Hacker')}
26
26
  let(:query) {RDF::Query.new {pattern [:s, :p, :o]}}
27
27
 
28
28
  ##
@@ -86,6 +86,7 @@ module RDF_Queryable
86
86
  subject.query([:s, :p, :o]) {}
87
87
  end
88
88
  end
89
+
89
90
  context "with a Query argument" do
90
91
  it "yields statements" do
91
92
  subject.query(query) do |solution|
@@ -103,49 +104,65 @@ module RDF_Queryable
103
104
  end
104
105
 
105
106
  context "without a block" do
106
- it "returns an enumerator" do
107
- expect(subject.query([nil, nil, nil])).to be_an_enumerator
108
- end
107
+ context "with a triple argument" do
108
+ it "returns an enumerator" do
109
+ expect(subject.query([nil, nil, nil])).to be_an_enumerator
110
+ end
109
111
 
110
- it "returns an enumerable enumerator" do
111
- expect(subject.query([nil, nil, nil])).to be_enumerable
112
- end
112
+ it "returns an enumerable enumerator" do
113
+ expect(subject.query([nil, nil, nil])).to be_enumerable
114
+ end
113
115
 
114
- it "returns a queryable enumerator" do
115
- expect(subject.query([nil, nil, nil])).to be_queryable
116
- end
116
+ it "returns a queryable enumerator" do
117
+ expect(subject.query([nil, nil, nil])).to be_queryable
118
+ end
117
119
 
118
- it "returns statements given a triple" do
119
- subject.query([nil, nil, nil]).each do |statement|
120
- expect(statement).to be_a_statement
121
- expect(statement).not_to be_a RDF::Query::Solution
120
+ it "returns statements given a triple" do
121
+ subject.query([nil, nil, nil]).each do |statement|
122
+ expect(statement).to be_a_statement
123
+ expect(statement).not_to be_a RDF::Query::Solution
124
+ end
122
125
  end
123
126
  end
124
127
 
125
- it "returns solutions given a query" do
126
- subject.query(query).each do |solution|
127
- expect(solution).not_to be_a_statement
128
- expect(solution).to be_a RDF::Query::Solution
128
+ context "with a Query argument" do
129
+ it "returns solutions" do
130
+ expect(subject.query(query)).to be_a(RDF::Query::Solutions)
129
131
  end
130
- end
131
132
 
132
- it "returns the correct number of results for array queries" do
133
- expect(subject.query([nil, nil, nil]).size).to eq @statements.size
134
- expect(subject.query([resource, nil, nil]).size).to eq File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
135
- expect(subject.query([RDF::URI("http://ar.to/#self"), nil, nil]).size).to eq File.readlines(@doap).grep(/^<http:\/\/ar.to\/\#self>/).size
136
- expect(subject.query([resource, RDF::DOAP.name, nil]).size).to eq 1
137
- expect(subject.query([nil, nil, RDF::DOAP.Project]).size).to eq 1
138
- end
133
+ it "does not return an enumerable enumerator" do
134
+ expect(subject.query(query)).not_to be_enumerable
135
+ end
139
136
 
140
- it "returns the correct number of results for hash queries" do
141
- expect(subject.query({}).size).to eq @statements.size
142
- expect(subject.query(:subject => resource).size).to eq File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
143
- expect(subject.query(:subject => resource, :predicate => RDF::DOAP.name).size).to eq 1
144
- expect(subject.query(:object => RDF::DOAP.Project).size).to eq 1
145
- end
137
+ it "does not return a queryable enumerator" do
138
+ expect(subject.query(query)).not_to be_queryable
139
+ end
146
140
 
147
- it "returns the correct number of results for query queries" do
148
- expect(subject.query(query).size).to eq @statements.size
141
+ it "returns solutions given a query" do
142
+ subject.query(query).each do |solution|
143
+ expect(solution).not_to be_a_statement
144
+ expect(solution).to be_a RDF::Query::Solution
145
+ end
146
+ end
147
+
148
+ it "returns the correct number of results for array queries" do
149
+ expect(subject.query([nil, nil, nil]).size).to eq @statements.size
150
+ expect(subject.query([resource, nil, nil]).size).to eq File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
151
+ expect(subject.query([RDF::URI("http://ar.to/#self"), nil, nil]).size).to eq File.readlines(@doap).grep(/^<http:\/\/ar.to\/\#self>/).size
152
+ expect(subject.query([resource, RDF::DOAP.name, nil]).size).to eq 1
153
+ expect(subject.query([nil, nil, RDF::DOAP.Project]).size).to eq 1
154
+ end
155
+
156
+ it "returns the correct number of results for hash queries" do
157
+ expect(subject.query({}).size).to eq @statements.size
158
+ expect(subject.query(:subject => resource).size).to eq File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
159
+ expect(subject.query(:subject => resource, :predicate => RDF::DOAP.name).size).to eq 1
160
+ expect(subject.query(:object => RDF::DOAP.Project).size).to eq 1
161
+ end
162
+
163
+ it "returns the correct number of results for query queries" do
164
+ expect(subject.query(query).size).to eq @statements.size
165
+ end
149
166
  end
150
167
  end
151
168
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0p4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-12 00:00:00.000000000 Z
13
+ date: 2013-11-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
@@ -18,40 +18,40 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.1.0
21
+ version: '1.1'
22
22
  type: :development
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: 1.1.0
28
+ version: '1.1'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rspec
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ! '>='
33
+ - - '>='
34
34
  - !ruby/object:Gem::Version
35
- version: '2.12'
35
+ version: '2.14'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ! '>='
40
+ - - '>='
41
41
  - !ruby/object:Gem::Version
42
- version: '2.12'
42
+ version: '2.14'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: yard
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ! '>='
47
+ - - '>='
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0.8'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ! '>='
54
+ - - '>='
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0.8'
57
57
  description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF
@@ -102,17 +102,17 @@ require_paths:
102
102
  - lib
103
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ! '>='
105
+ - - '>='
106
106
  - !ruby/object:Gem::Version
107
107
  version: 1.9.2
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ! '>'
110
+ - - '>='
111
111
  - !ruby/object:Gem::Version
112
- version: 1.3.1
112
+ version: '0'
113
113
  requirements: []
114
114
  rubyforge_project: rdf
115
- rubygems_version: 2.0.5
115
+ rubygems_version: 2.1.11
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: RSpec extensions for RDF.rb.