Skip to content

Commit 5069156

Browse files
committed
Finish 2.2.0-rc1
2 parents 0eefc91 + c8bf756 commit 5069156

File tree

13 files changed

+102
-87
lines changed

13 files changed

+102
-87
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ script: "bundle exec rspec spec"
44
env:
55
- CI=true
66
rvm:
7-
- 2.0
8-
- 2.1
9-
- 2.2.4
10-
- 2.3.0
11-
- jruby-9.0.4.0
12-
- rbx-2
7+
- 2.2.6
8+
- 2.3.3
9+
- 2.4.0
10+
- jruby
11+
- rbx
1312
cache: bundler
1413
sudo: false
1514
matrix:
1615
allow_failures:
17-
- rvm: rbx-2
16+
- rvm: rbx
17+
- rvm: jruby

Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ gemspec
55
gem 'rdf', github: "ruby-rdf/rdf", branch: "develop"
66
gem 'rdf-isomorphic', github: "ruby-rdf/rdf-isomorphic", branch: "develop"
77

8-
group :development do
9-
gem "wirble"
10-
end
11-
128
group :debug do
139
gem "byebug", platform: :mri
1410
end

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Note that in most cases, if the instance is empty and mutable, the appropriate s
3131

3232
## Dependencies
3333

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)
3636

3737
## Installation
3838

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0
1+
2.2.0-rc1

dependencyci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
platform:
2+
Rubygems:
3+
rdf-isomorphic:
4+
tests:
5+
unmaintained: skip

lib/rdf/spec/enumerable.rb

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,16 @@
391391

392392
its(:each_term) {is_expected.to be_an_enumerator}
393393
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?} }
399404
end
400405

401406
its(:enum_term) {is_expected.to be_an_enumerator}
@@ -507,11 +512,23 @@
507512

508513

509514
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
513523
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)
515532
end
516533
end
517534
end

lib/rdf/spec/mutable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
it 'handles Graph names' do
263263
if @supports_named_graphs
264264
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')))
266266
end
267267
dels.map! { |st| st.graph_name = RDF::URI('http://example.com/fake'); st }
268268
dels.extend(RDF::Enumerable)

lib/rdf/spec/queryable.rb

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,31 @@
6060

6161
context "with specific patterns" do
6262
# 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|
7278
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)
7384
solutions = []
85+
7486
subject.send(method, pattern) {|s| solutions << s}
87+
7588
expect(solutions).to contain_exactly(*result)
7689
end
7790
end
@@ -85,18 +98,6 @@
8598
expect(solutions.size).to eq @statements.size
8699
end
87100

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-
100101
it "returns statements from named graphs with variable graph_name" do
101102
unless subject.graph_names.to_a.empty?
102103
pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: :c)
@@ -276,7 +277,9 @@
276277
end
277278

278279
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
280283
end
281284

282285
it "has xi1 as a solution" do
@@ -296,7 +299,9 @@
296299
end
297300

298301
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
300305
end
301306

302307
it "has xd1 as a solution" do
@@ -314,8 +319,7 @@
314319
before { skip unless subject.respond_to?(:query_execute, true ) }
315320

316321
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
319323
end
320324

321325
include_examples 'query execution', :query_execute
@@ -327,7 +331,7 @@
327331
before { skip unless subject.respond_to?(:query_pattern, true ) }
328332

329333
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
331335
end
332336

333337
include_examples 'query pattern', :query_pattern

lib/rdf/spec/repository.rb

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,6 @@
4848
end
4949
end
5050

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-
8051
context "with snapshot support" do
8152

8253
describe '#snapshot' do

lib/rdf/spec/transactable.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
end
1919

2020
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'))
2224
expect(subject).to receive(:commit_transaction).and_call_original
2325

2426
expect do

0 commit comments

Comments
 (0)