From 0f8bebe0e3301423df5579384ea163bcbed6db11 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 8 Jul 2016 14:38:57 -0700 Subject: [PATCH 01/13] Update minumum ruby version to 2.2.2. See https://github.com/ruby-rdf/rdf/issues/307. --- .travis.yml | 2 -- rdf-spec.gemspec | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d5c433..3f87e92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ script: "bundle exec rspec spec" env: - CI=true rvm: - - 2.0 - - 2.1 - 2.2.4 - 2.3.0 - jruby-9.0.4.0 diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 8d765e6..c89fc81 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |gem| gem.test_files = %w() gem.has_rdoc = false - gem.required_ruby_version = '>= 2.0' + gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] gem.add_runtime_dependency 'rdf', '~> 2.0' gem.add_runtime_dependency 'rdf-isomorphic', '~> 2.0' From e8d8c3b8a30f7b0a3115f970909ebceecbd0de6a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 8 Jul 2016 14:44:31 -0700 Subject: [PATCH 02/13] Dependency update in README and update ruby versions in travis-ci. --- .travis.yml | 10 +++++----- README.md | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f87e92..2deee97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,12 @@ script: "bundle exec rspec spec" env: - CI=true rvm: - - 2.2.4 - - 2.3.0 - - jruby-9.0.4.0 - - rbx-2 + - 2.2.5 + - 2.3.1 + - jruby-9.0.5.0 + - rbx cache: bundler sudo: false matrix: allow_failures: - - rvm: rbx-2 + - rvm: rbx diff --git a/README.md b/README.md index b7587fc..5361fe3 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ Note that in most cases, if the instance is empty and mutable, the appropriate s ## Dependencies -* [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.1) -* [RSpec](http://rubygems.org/gems/rspec) (>= 2.1.0) +* [RDF.rb](http://rubygems.org/gems/rdf) (~> 2.0) +* [RSpec](http://rubygems.org/gems/rspec) (~> 3.0) ## Installation From 6e300849ccd46d4ce09b393446c3a9884ba39063 Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Fri, 12 Aug 2016 15:12:30 -0700 Subject: [PATCH 03/13] Tests `Transaction#mutate?` We deliberately avoid checking for false positives, since the interface makes no guarantee that they won't appear. --- lib/rdf/spec/transaction.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/rdf/spec/transaction.rb b/lib/rdf/spec/transaction.rb index 8be8e32..ef9ca0f 100644 --- a/lib/rdf/spec/transaction.rb +++ b/lib/rdf/spec/transaction.rb @@ -250,6 +250,26 @@ end end + describe '#mutated?' do + let(:st) { RDF::Statement(:s, RDF::URI('http://example.com/p'), 'o') } + + it 'returns true after a successful insert' do + begin + expect { subject.insert(st) } + .to change { subject.mutated? }.from(false).to(true) + rescue NotImplementedError; end + end + + it 'returns true after a successful delete' do + repository.insert(st) + + begin + expect { subject.delete(st) } + .to change { subject.mutated? }.from(false).to(true) + rescue NotImplementedError; end + end + end + describe '#execute' do let(:st) { RDF::Statement(:s, RDF::URI('http://example.com/p'), 'o') } From 88fddd4923ef32e72ee2e3a47535721fd50c3f98 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 12 Aug 2016 18:14:46 -0700 Subject: [PATCH 04/13] Remove wirble from Gemfile, as dependency-ci objects that it has no license and it's not really neccessary. --- .travis.yml | 2 +- Gemfile | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2deee97..ff3ca1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ env: rvm: - 2.2.5 - 2.3.1 - - jruby-9.0.5.0 + - jruby-9.1.2.0 - rbx cache: bundler sudo: false diff --git a/Gemfile b/Gemfile index cf8b9a2..a78d207 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,6 @@ gemspec gem 'rdf', github: "ruby-rdf/rdf", branch: "develop" gem 'rdf-isomorphic', github: "ruby-rdf/rdf-isomorphic", branch: "develop" -group :development do - gem "wirble" -end - group :debug do gem "byebug", platform: :mri end From 08b72efbd9ca6d1b5221724cf2ee01de6442b524 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 13 Aug 2016 15:22:00 -0700 Subject: [PATCH 05/13] Change Travis JRuby to default and allow failures. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff3ca1d..24a5a31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,11 @@ env: rvm: - 2.2.5 - 2.3.1 - - jruby-9.1.2.0 + - jruby - rbx cache: bundler sudo: false matrix: allow_failures: - - rvm: rbx + - rvm: rbx + - rvm: jruby From 122fb39ea592012bf53ec7eb92ddf12facaabf5c Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Tue, 16 Aug 2016 13:26:50 -0700 Subject: [PATCH 06/13] Generalize protected method check for Queryable --- lib/rdf/spec/queryable.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/rdf/spec/queryable.rb b/lib/rdf/spec/queryable.rb index 76954fc..c937afa 100644 --- a/lib/rdf/spec/queryable.rb +++ b/lib/rdf/spec/queryable.rb @@ -314,8 +314,7 @@ before { skip unless subject.respond_to?(:query_execute, true ) } it "defines a protected #query_execute method" do - expect(subject.class.protected_method_defined?(:query_execute)) - .to be_truthy + expect(subject.protected_methods).to include :query_execute end include_examples 'query execution', :query_execute @@ -327,7 +326,7 @@ before { skip unless subject.respond_to?(:query_pattern, true ) } it "defines a protected #query_pattern method" do - expect(subject.class.protected_method_defined?(:query_pattern)).to be_truthy + expect(subject.protected_methods).to include :query_pattern end include_examples 'query pattern', :query_pattern From 7d67f82f0a2a0a9b3e84d021c8f288e9f8d2b35e Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Tue, 16 Aug 2016 13:29:10 -0700 Subject: [PATCH 07/13] Remove `false` as default assumption in Queryable specs This assumption has only held for `RDF::Repository` in the past. The test should be replaced in either `Repository` or `Dataset`. --- lib/rdf/spec/queryable.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/rdf/spec/queryable.rb b/lib/rdf/spec/queryable.rb index c937afa..385df57 100644 --- a/lib/rdf/spec/queryable.rb +++ b/lib/rdf/spec/queryable.rb @@ -85,18 +85,6 @@ expect(solutions.size).to eq @statements.size end - it "returns statements from unnamed graphs with false graph_name" do - pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: false) - solutions = [] - subject.send(method, pattern) {|s| solutions << s} - - named_statements = subject.statements - named_statements.reject! {|st| st.has_name?} unless - subject.respond_to?(:graph_name) && !subject.graph_name.nil? - - expect(solutions.size).to eq named_statements.size - end - it "returns statements from named graphs with variable graph_name" do unless subject.graph_names.to_a.empty? pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: :c) From a811c4b86c861df10a36263926ac2a79ee2fe83f Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Fri, 30 Sep 2016 13:12:09 -0700 Subject: [PATCH 08/13] Remove duplicate Transactable tests from Repository --- lib/rdf/spec/repository.rb | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/lib/rdf/spec/repository.rb b/lib/rdf/spec/repository.rb index 717693c..fbedb16 100644 --- a/lib/rdf/spec/repository.rb +++ b/lib/rdf/spec/repository.rb @@ -48,35 +48,6 @@ end end - describe "#transaction" do - it 'gives an immutable transaction' do - expect { subject.transaction { insert([]) } }.to raise_error TypeError - end - - it 'commits a successful transaction' do - statement = RDF::Statement(:s, RDF.type, :o) - expect(subject).to receive(:commit_transaction).and_call_original - - expect do - subject.transaction(mutable: true) { insert(statement) } - end.to change { subject.statements }.to include(statement) - end - - it 'rolls back a failed transaction' do - original_contents = subject.statements - expect(subject).to receive(:rollback_transaction).and_call_original - - expect do - subject.transaction(mutable: true) do - delete(*@statements) - raise 'my error' - end - end.to raise_error RuntimeError - - expect(subject.statements).to contain_exactly(*original_contents) - end - end - context "with snapshot support" do describe '#snapshot' do From 0acb7186b58b13cd283c020427527270bd5e30a5 Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Fri, 30 Sep 2016 13:13:29 -0700 Subject: [PATCH 09/13] Isolate Transactable#transaction test from blank nodes This test used to implictly test stablity of blank node identifers across multiple `#statements` calls. By using URIs instead of blank nodes, we avoid failures when they change. --- lib/rdf/spec/transactable.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rdf/spec/transactable.rb b/lib/rdf/spec/transactable.rb index dc5ca5c..8d2a35b 100644 --- a/lib/rdf/spec/transactable.rb +++ b/lib/rdf/spec/transactable.rb @@ -18,7 +18,9 @@ end it 'commits a successful transaction' do - statement = RDF::Statement(:s, RDF.type, :o) + statement = RDF::Statement(RDF::URI('http://example.com/s'), + RDF.type, + RDF::URI('http://example.com/o')) expect(subject).to receive(:commit_transaction).and_call_original expect do From 1086cc1a5a11d845c25e9a2bd99776e022d3ec18 Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Fri, 30 Sep 2016 14:03:04 -0700 Subject: [PATCH 10/13] Filter for `#supports?(:literal_equality)` Closes #66. --- lib/rdf/spec/enumerable.rb | 15 ++++++++++----- lib/rdf/spec/queryable.rb | 39 +++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/lib/rdf/spec/enumerable.rb b/lib/rdf/spec/enumerable.rb index 8be1a08..b98eb37 100644 --- a/lib/rdf/spec/enumerable.rb +++ b/lib/rdf/spec/enumerable.rb @@ -391,11 +391,16 @@ its(:each_term) {is_expected.to be_an_enumerator} context "#each_term" do - specify { - expect(subject.each_term.reject(&:node?).size).to eq non_bnode_terms.length - } - specify {expect(subject.each_term).to all(be_a_term)} - specify {subject.each_term {|value| expect(non_bnode_terms).to include(value) unless value.node?}} + it 'has correct number of terms' do + expected_count = non_bnode_terms.length + expected_count = expected_count - 3 unless + subject.supports?(:literal_equality) + + expect(subject.each_term.reject(&:node?).size).to eq expected_count + end + + specify { expect(subject.each_term).to all(be_a_term) } + specify { subject.each_term {|value| expect(non_bnode_terms).to include(value) unless value.node?} } end its(:enum_term) {is_expected.to be_an_enumerator} diff --git a/lib/rdf/spec/queryable.rb b/lib/rdf/spec/queryable.rb index 385df57..510bc56 100644 --- a/lib/rdf/spec/queryable.rb +++ b/lib/rdf/spec/queryable.rb @@ -60,18 +60,31 @@ context "with specific patterns" do # Note that "01" should not match 1, per data-r2/expr-equal/sameTerm - { - [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])], - [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])], - [RDF::URI("http://example.org/xi1"), nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])], - [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])], - [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])], - [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")])], - }.each do |pattern, result| - pattern = RDF::Query::Pattern.from(pattern) + patterns = + { [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])], + [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])], + [RDF::URI("http://example.org/xi1"), nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])], + [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])], + [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])], + [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")])], + } + + literal_eq_patterns = + [[nil, RDF::URI("http://example.org/p"), 1], + [nil, nil, 1], + [nil, RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")]] + + patterns.each do |pattern, result| it "returns #{result.inspect} given #{pattern.inspect}" do + unless subject.supports?(:literal_equality) + next if literal_eq_patterns.include?(pattern) + end + + pattern = RDF::Query::Pattern.from(pattern) solutions = [] + subject.send(method, pattern) {|s| solutions << s} + expect(solutions).to contain_exactly(*result) end end @@ -264,7 +277,9 @@ end it 'has two solutions' do - expect(result.count).to eq 2 + if subject.supports?(:literal_equality) + expect(result.count).to eq 2 + end end it "has xi1 as a solution" do @@ -284,7 +299,9 @@ end it 'has one solution' do - expect(result.count).to eq 1 + if subject.supports?(:literal_equality) + expect(result.count).to eq 1 + end end it "has xd1 as a solution" do From 9ba906efb7596d2173a8cc539a2dfe6e73474db2 Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Wed, 28 Dec 2016 15:06:48 -0800 Subject: [PATCH 11/13] Add Ruby 2.4 support Updates the build matrix match RDF.rb, and adds 2.4.0. Updates the dependency on `webmock` to 2.x to avoid errors due to lack of Ruby 2.4 support in `webmock` 1.x. --- .travis.yml | 5 +++-- rdf-spec.gemspec | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24a5a31..f5b20ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,9 @@ script: "bundle exec rspec spec" env: - CI=true rvm: - - 2.2.5 - - 2.3.1 + - 2.2.6 + - 2.3.3 + - 2.4.0 - jruby - rbx cache: bundler diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index c89fc81..9536dbb 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'rdf-isomorphic', '~> 2.0' gem.add_runtime_dependency 'rspec', '~> 3.0' gem.add_runtime_dependency 'rspec-its', '~> 1.0' - gem.add_runtime_dependency 'webmock', '~> 1.17' + gem.add_runtime_dependency 'webmock', '~> 2.3' gem.add_development_dependency 'yard' , '~> 0.8' gem.post_install_message = nil end From 964758459855b173339a5e265ce3a571dcdc4c4a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 28 Dec 2016 16:54:12 -0800 Subject: [PATCH 12/13] Use `#to_h` instead of `#to_hash`. Test for DEPRECATION on uses of `#to_hash`. This is associated with ruby-rdf/rdf#333. --- VERSION | 2 +- dependencyci.yml | 5 +++++ lib/rdf/spec/enumerable.rb | 20 ++++++++++++++++---- lib/rdf/spec/mutable.rb | 2 +- lib/rdf/spec/writable.rb | 6 +++--- 5 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 dependencyci.yml diff --git a/VERSION b/VERSION index 227cea2..7ec1d6d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 +2.1.0 diff --git a/dependencyci.yml b/dependencyci.yml new file mode 100644 index 0000000..0c67c1b --- /dev/null +++ b/dependencyci.yml @@ -0,0 +1,5 @@ +platform: + Rubygems: + rdf-isomorphic: + tests: + unmaintained: skip \ No newline at end of file diff --git a/lib/rdf/spec/enumerable.rb b/lib/rdf/spec/enumerable.rb index b98eb37..4cf0d37 100644 --- a/lib/rdf/spec/enumerable.rb +++ b/lib/rdf/spec/enumerable.rb @@ -512,11 +512,23 @@ context "when converting" do - it {is_expected.to respond_to(:to_hash)} - its(:to_hash) {is_expected.to be_instance_of(Hash)} - context "#to_hash" do + it {is_expected.to respond_to(:to_h)} + it {is_expected.not_to respond_to(:to_hash)} + its(:to_hash) { + expect { + is_expected.to be_instance_of(Hash) + }.to write("DEPRECATION").to(:error) + } + describe "#to_h" do it "should have as many keys as subjects" do - expect(subject.to_hash.keys.size).to eq enumerable.subjects.to_a.size + expect(subject.to_h.keys.size).to eq enumerable.subjects.to_a.size + end + end + describe "#to_h" do + it "should have as many keys as subjects (with deprecation)" do + expect { + expect(subject.to_hash.keys.size).to eq enumerable.subjects.to_a.size + }.to write("DEPRECATION").to(:error) end end end diff --git a/lib/rdf/spec/mutable.rb b/lib/rdf/spec/mutable.rb index 72d38d7..1611a73 100644 --- a/lib/rdf/spec/mutable.rb +++ b/lib/rdf/spec/mutable.rb @@ -262,7 +262,7 @@ it 'handles Graph names' do if @supports_named_graphs dels = non_bnode_statements.take(10).map do |st| - RDF::Statement.from(st.to_hash.merge(graph_name: RDF::URI('http://example.com/fake'))) + RDF::Statement.from(st.to_h.merge(graph_name: RDF::URI('http://example.com/fake'))) end dels.map! { |st| st.graph_name = RDF::URI('http://example.com/fake'); st } dels.extend(RDF::Enumerable) diff --git a/lib/rdf/spec/writable.rb b/lib/rdf/spec/writable.rb index fc3c6f5..f111dc1 100644 --- a/lib/rdf/spec/writable.rb +++ b/lib/rdf/spec/writable.rb @@ -126,9 +126,9 @@ end it "should not insert an incomplete statement" do - expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(subject: nil)))}.to raise_error(ArgumentError) - expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(predicate: nil)))}.to raise_error(ArgumentError) - expect {subject.insert(RDF::Statement.from(statement.to_hash.merge(object: nil)))}.to raise_error(ArgumentError) + expect {subject.insert(RDF::Statement.from(statement.to_h.merge(subject: nil)))}.to raise_error(ArgumentError) + expect {subject.insert(RDF::Statement.from(statement.to_h.merge(predicate: nil)))}.to raise_error(ArgumentError) + expect {subject.insert(RDF::Statement.from(statement.to_h.merge(object: nil)))}.to raise_error(ArgumentError) expect(subject.count).to eql 0 end From c8bf75638eaf9647f680e27e5f219db1bc06105b Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 31 Dec 2016 13:19:48 -0800 Subject: [PATCH 13/13] Version 2.2.0-rc1. --- VERSION | 2 +- rdf-spec.gemspec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 7ec1d6d..a1bba89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0 +2.2.0-rc1 diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 9536dbb..0814d07 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -27,9 +27,9 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] - gem.add_runtime_dependency 'rdf', '~> 2.0' + gem.add_runtime_dependency 'rdf', '~> 2.1' gem.add_runtime_dependency 'rdf-isomorphic', '~> 2.0' - gem.add_runtime_dependency 'rspec', '~> 3.0' + gem.add_runtime_dependency 'rspec', '~> 3.5' gem.add_runtime_dependency 'rspec-its', '~> 1.0' gem.add_runtime_dependency 'webmock', '~> 2.3' gem.add_development_dependency 'yard' , '~> 0.8'