rdf-spec 2.0.0 → 2.2.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5923d4023275de0893d783a5837fce6caed4e437
4
- data.tar.gz: 43e6dee9a84e1da0adc0a95d3bd335d84134e7aa
3
+ metadata.gz: 02763a4f5919a3620e632e6c5407a85ead6a31b6
4
+ data.tar.gz: e0b955d1548f7aac679dd228ef05e7b20bfa2e0c
5
5
  SHA512:
6
- metadata.gz: a73e8d511c0f919213b0a242df581877edb0a067c8580d8377decbacc892e4bb01c20622cc1c2763f452da9fa9895781d463cb7f5218b81e1923635fb8ac3a44
7
- data.tar.gz: 1f7e0ff4f0239a676c38288120e8f7440ccb5ea69e4b25856326ea5420125cd3da40121012535a8ebc3ddefc479d3a5a769564afc6533d1a278e511fe4c7285b
6
+ metadata.gz: e4093900bf924b487bea8e8d8412bec0be59343b9a6a5c9ede606e3cf79bee0a40befcd53f7b08631e73edb8dd18f9e2148fe5b98a627cc042b937f43b5dc21f
7
+ data.tar.gz: af748d60323daba596933ff153b4544f474a8778bd1b9232a34d2773c64b3ea04e2263a50c7772778448f3f6c794b2cfe08e27c141e3acf226d1818e022b6299
data/README.md CHANGED
@@ -31,8 +31,8 @@ Note that in most cases, if the instance is empty and mutable, the appropriate s
31
31
 
32
32
  ## Dependencies
33
33
 
34
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.1)
35
- * [RSpec](http://rubygems.org/gems/rspec) (>= 2.1.0)
34
+ * [RDF.rb](http://rubygems.org/gems/rdf) (~> 2.0)
35
+ * [RSpec](http://rubygems.org/gems/rspec) (~> 3.0)
36
36
 
37
37
  ## Installation
38
38
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.2.0-rc1
@@ -391,11 +391,16 @@ RSpec.shared_examples 'an RDF::Enumerable' do
391
391
 
392
392
  its(:each_term) {is_expected.to be_an_enumerator}
393
393
  context "#each_term" do
394
- specify {
395
- expect(subject.each_term.reject(&:node?).size).to eq non_bnode_terms.length
396
- }
397
- specify {expect(subject.each_term).to all(be_a_term)}
398
- specify {subject.each_term {|value| expect(non_bnode_terms).to include(value) unless value.node?}}
394
+ it 'has correct number of terms' do
395
+ expected_count = non_bnode_terms.length
396
+ expected_count = expected_count - 3 unless
397
+ subject.supports?(:literal_equality)
398
+
399
+ expect(subject.each_term.reject(&:node?).size).to eq expected_count
400
+ end
401
+
402
+ specify { expect(subject.each_term).to all(be_a_term) }
403
+ specify { subject.each_term {|value| expect(non_bnode_terms).to include(value) unless value.node?} }
399
404
  end
400
405
 
401
406
  its(:enum_term) {is_expected.to be_an_enumerator}
@@ -507,11 +512,23 @@ RSpec.shared_examples 'an RDF::Enumerable' do
507
512
 
508
513
 
509
514
  context "when converting" do
510
- it {is_expected.to respond_to(:to_hash)}
511
- its(:to_hash) {is_expected.to be_instance_of(Hash)}
512
- context "#to_hash" do
515
+ it {is_expected.to respond_to(:to_h)}
516
+ it {is_expected.not_to respond_to(:to_hash)}
517
+ its(:to_hash) {
518
+ expect {
519
+ is_expected.to be_instance_of(Hash)
520
+ }.to write("DEPRECATION").to(:error)
521
+ }
522
+ describe "#to_h" do
513
523
  it "should have as many keys as subjects" do
514
- expect(subject.to_hash.keys.size).to eq enumerable.subjects.to_a.size
524
+ expect(subject.to_h.keys.size).to eq enumerable.subjects.to_a.size
525
+ end
526
+ end
527
+ describe "#to_h" do
528
+ it "should have as many keys as subjects (with deprecation)" do
529
+ expect {
530
+ expect(subject.to_hash.keys.size).to eq enumerable.subjects.to_a.size
531
+ }.to write("DEPRECATION").to(:error)
515
532
  end
516
533
  end
517
534
  end
@@ -262,7 +262,7 @@ RSpec.shared_examples 'an RDF::Mutable' do
262
262
  it 'handles Graph names' do
263
263
  if @supports_named_graphs
264
264
  dels = non_bnode_statements.take(10).map do |st|
265
- RDF::Statement.from(st.to_hash.merge(graph_name: RDF::URI('http://example.com/fake')))
265
+ RDF::Statement.from(st.to_h.merge(graph_name: RDF::URI('http://example.com/fake')))
266
266
  end
267
267
  dels.map! { |st| st.graph_name = RDF::URI('http://example.com/fake'); st }
268
268
  dels.extend(RDF::Enumerable)
@@ -60,18 +60,31 @@ RSpec.shared_examples 'an RDF::Queryable' do
60
60
 
61
61
  context "with specific patterns" do
62
62
  # Note that "01" should not match 1, per data-r2/expr-equal/sameTerm
63
- {
64
- [RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
65
- [RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), nil] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
66
- [RDF::URI("http://example.org/xi1"), nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
67
- [nil, RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
68
- [nil, nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
69
- [nil, RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")] => [RDF::Statement.from([RDF::URI("http://example.org/xd1"), RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")])],
70
- }.each do |pattern, result|
71
- pattern = RDF::Query::Pattern.from(pattern)
63
+ patterns =
64
+ { [RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
65
+ [RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), nil] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
66
+ [RDF::URI("http://example.org/xi1"), nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
67
+ [nil, RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
68
+ [nil, nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
69
+ [nil, RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")] => [RDF::Statement.from([RDF::URI("http://example.org/xd1"), RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")])],
70
+ }
71
+
72
+ literal_eq_patterns =
73
+ [[nil, RDF::URI("http://example.org/p"), 1],
74
+ [nil, nil, 1],
75
+ [nil, RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")]]
76
+
77
+ patterns.each do |pattern, result|
72
78
  it "returns #{result.inspect} given #{pattern.inspect}" do
79
+ unless subject.supports?(:literal_equality)
80
+ next if literal_eq_patterns.include?(pattern)
81
+ end
82
+
83
+ pattern = RDF::Query::Pattern.from(pattern)
73
84
  solutions = []
85
+
74
86
  subject.send(method, pattern) {|s| solutions << s}
87
+
75
88
  expect(solutions).to contain_exactly(*result)
76
89
  end
77
90
  end
@@ -85,18 +98,6 @@ RSpec.shared_examples 'an RDF::Queryable' do
85
98
  expect(solutions.size).to eq @statements.size
86
99
  end
87
100
 
88
- it "returns statements from unnamed graphs with false graph_name" do
89
- pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: false)
90
- solutions = []
91
- subject.send(method, pattern) {|s| solutions << s}
92
-
93
- named_statements = subject.statements
94
- named_statements.reject! {|st| st.has_name?} unless
95
- subject.respond_to?(:graph_name) && !subject.graph_name.nil?
96
-
97
- expect(solutions.size).to eq named_statements.size
98
- end
99
-
100
101
  it "returns statements from named graphs with variable graph_name" do
101
102
  unless subject.graph_names.to_a.empty?
102
103
  pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: :c)
@@ -276,7 +277,9 @@ RSpec.shared_examples 'an RDF::Queryable' do
276
277
  end
277
278
 
278
279
  it 'has two solutions' do
279
- expect(result.count).to eq 2
280
+ if subject.supports?(:literal_equality)
281
+ expect(result.count).to eq 2
282
+ end
280
283
  end
281
284
 
282
285
  it "has xi1 as a solution" do
@@ -296,7 +299,9 @@ RSpec.shared_examples 'an RDF::Queryable' do
296
299
  end
297
300
 
298
301
  it 'has one solution' do
299
- expect(result.count).to eq 1
302
+ if subject.supports?(:literal_equality)
303
+ expect(result.count).to eq 1
304
+ end
300
305
  end
301
306
 
302
307
  it "has xd1 as a solution" do
@@ -314,8 +319,7 @@ RSpec.shared_examples 'an RDF::Queryable' do
314
319
  before { skip unless subject.respond_to?(:query_execute, true ) }
315
320
 
316
321
  it "defines a protected #query_execute method" do
317
- expect(subject.class.protected_method_defined?(:query_execute))
318
- .to be_truthy
322
+ expect(subject.protected_methods).to include :query_execute
319
323
  end
320
324
 
321
325
  include_examples 'query execution', :query_execute
@@ -327,7 +331,7 @@ RSpec.shared_examples 'an RDF::Queryable' do
327
331
  before { skip unless subject.respond_to?(:query_pattern, true ) }
328
332
 
329
333
  it "defines a protected #query_pattern method" do
330
- expect(subject.class.protected_method_defined?(:query_pattern)).to be_truthy
334
+ expect(subject.protected_methods).to include :query_pattern
331
335
  end
332
336
 
333
337
  include_examples 'query pattern', :query_pattern
@@ -48,35 +48,6 @@ RSpec.shared_examples 'an RDF::Repository' do
48
48
  end
49
49
  end
50
50
 
51
- describe "#transaction" do
52
- it 'gives an immutable transaction' do
53
- expect { subject.transaction { insert([]) } }.to raise_error TypeError
54
- end
55
-
56
- it 'commits a successful transaction' do
57
- statement = RDF::Statement(:s, RDF.type, :o)
58
- expect(subject).to receive(:commit_transaction).and_call_original
59
-
60
- expect do
61
- subject.transaction(mutable: true) { insert(statement) }
62
- end.to change { subject.statements }.to include(statement)
63
- end
64
-
65
- it 'rolls back a failed transaction' do
66
- original_contents = subject.statements
67
- expect(subject).to receive(:rollback_transaction).and_call_original
68
-
69
- expect do
70
- subject.transaction(mutable: true) do
71
- delete(*@statements)
72
- raise 'my error'
73
- end
74
- end.to raise_error RuntimeError
75
-
76
- expect(subject.statements).to contain_exactly(*original_contents)
77
- end
78
- end
79
-
80
51
  context "with snapshot support" do
81
52
 
82
53
  describe '#snapshot' do
@@ -18,7 +18,9 @@ RSpec.shared_examples 'an RDF::Transactable' do
18
18
  end
19
19
 
20
20
  it 'commits a successful transaction' do
21
- statement = RDF::Statement(:s, RDF.type, :o)
21
+ statement = RDF::Statement(RDF::URI('http://example.com/s'),
22
+ RDF.type,
23
+ RDF::URI('http://example.com/o'))
22
24
  expect(subject).to receive(:commit_transaction).and_call_original
23
25
 
24
26
  expect do
@@ -250,6 +250,26 @@ shared_examples "an RDF::Transaction" do |klass|
250
250
  end
251
251
  end
252
252
 
253
+ describe '#mutated?' do
254
+ let(:st) { RDF::Statement(:s, RDF::URI('http://example.com/p'), 'o') }
255
+
256
+ it 'returns true after a successful insert' do
257
+ begin
258
+ expect { subject.insert(st) }
259
+ .to change { subject.mutated? }.from(false).to(true)
260
+ rescue NotImplementedError; end
261
+ end
262
+
263
+ it 'returns true after a successful delete' do
264
+ repository.insert(st)
265
+
266
+ begin
267
+ expect { subject.delete(st) }
268
+ .to change { subject.mutated? }.from(false).to(true)
269
+ rescue NotImplementedError; end
270
+ end
271
+ end
272
+
253
273
  describe '#execute' do
254
274
  let(:st) { RDF::Statement(:s, RDF::URI('http://example.com/p'), 'o') }
255
275
 
@@ -126,9 +126,9 @@ RSpec.shared_examples 'an RDF::Writable' do
126
126
  end
127
127
 
128
128
  it "should not insert an incomplete statement" do
129
- expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(subject: nil)))}.to raise_error(ArgumentError)
130
- expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(predicate: nil)))}.to raise_error(ArgumentError)
131
- expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(object: nil)))}.to raise_error(ArgumentError)
129
+ expect {subject.insert(RDF::Statement.from(statement.to_h.merge(subject: nil)))}.to raise_error(ArgumentError)
130
+ expect {subject.insert(RDF::Statement.from(statement.to_h.merge(predicate: nil)))}.to raise_error(ArgumentError)
131
+ expect {subject.insert(RDF::Statement.from(statement.to_h.merge(object: nil)))}.to raise_error(ArgumentError)
132
132
  expect(subject.count).to eql 0
133
133
  end
134
134
 
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: 2.0.0
4
+ version: 2.2.0.pre.rc1
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: 2016-04-10 00:00:00.000000000 Z
13
+ date: 2016-12-31 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: rdf-isomorphic
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '3.0'
49
+ version: '3.5'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '3.0'
56
+ version: '3.5'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rspec-its
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -74,14 +74,14 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '1.17'
77
+ version: '2.3'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '1.17'
84
+ version: '2.3'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: yard
87
87
  requirement: !ruby/object:Gem::Requirement
@@ -167,17 +167,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
167
  requirements:
168
168
  - - ">="
169
169
  - !ruby/object:Gem::Version
170
- version: '2.0'
170
+ version: 2.2.2
171
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - ">="
173
+ - - ">"
174
174
  - !ruby/object:Gem::Version
175
- version: '0'
175
+ version: 1.3.1
176
176
  requirements: []
177
177
  rubyforge_project: rdf
178
- rubygems_version: 2.4.8
178
+ rubygems_version: 2.6.8
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: RSpec extensions for RDF.rb.
182
182
  test_files: []
183
- has_rdoc: false