From c9d4e7f5eb091e0fc14c775e0f24b2e66cab164d Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 21 Feb 2017 08:47:19 -0800 Subject: [PATCH 01/16] Add `failure_message_when_negated` for `be_equivalent_graph`. --- lib/rdf/spec/matchers.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/rdf/spec/matchers.rb b/lib/rdf/spec/matchers.rb index a712a26..f0445d0 100644 --- a/lib/rdf/spec/matchers.rb +++ b/lib/rdf/spec/matchers.rb @@ -314,6 +314,19 @@ def normalize(graph) "Results:\n#{@actual.dump(format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" + "\nDebug:\n#{@info.logger}" end + + failure_message_when_negated do |actual| + format = case + when RDF.const_defined?(:TriG) then :trig + when RDF.const_defined?(:Turtle) then :ttl + else :nquads + end + info = @info.respond_to?(:information) ? @info.information : @info.inspect + "Graphs identical\n" + + "\n#{info + "\n" unless info.empty?}" + + "Results:\n#{actual.dump(format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" + + "\nDebug:\n#{@info.logger}" + end end require 'json' @@ -347,6 +360,15 @@ def normalize(graph) "\n#{info + "\n" unless info.empty?}" + "\nDebug:\n#{@info.logger}" end + + failure_message_when_negated do |actual| + info = @info.respond_to?(:information) ? @info.information : @info.inspect + + "Expected not to produce the following:\n" + + "Actual : #{actual.is_a?(String) ? actual : actual.to_json(JSON_STATE) rescue 'malformed json'}\n" + + "\n#{info + "\n" unless info.empty?}" + + "\nDebug:\n#{@info.logger}" + end end end # Matchers From 0488e3048e06f2fa84d65fe4f576c848e0ca56e4 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 21 Feb 2017 14:18:11 -0800 Subject: [PATCH 02/16] Don't run writer open tests over all formats, just that being tested. --- lib/rdf/spec/writer.rb | 65 +++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/lib/rdf/spec/writer.rb b/lib/rdf/spec/writer.rb index 22dd777..d0182c5 100644 --- a/lib/rdf/spec/writer.rb +++ b/lib/rdf/spec/writer.rb @@ -11,6 +11,7 @@ end let(:writer_class) { writer.class } let(:reader_class) { writer_class.format.reader} + let(:format_class) { writer_class.format } describe ".each" do it "yields each writer" do @@ -63,56 +64,48 @@ end it "yields writer given file_name" do - writer_class.format.each do |f| - f.file_extensions.each_pair do |sym, content_type| - writer_mock = double("writer") - expect(writer_mock).to receive(:got_here) - expect(writer_class).to receive(:for).with(file_name: "#{@basename}.#{sym}").and_return(writer_class) - writer_class.open("#{@basename}.#{sym}") do |r| - expect(r).to be_a(RDF::Writer) - writer_mock.got_here - end - end - end - end - - it "yields writer given symbol" do - writer_class.format.each do |f| - sym = f.to_sym # Like RDF::NTriples::Format => :ntriples + format_class.file_extensions.each_pair do |sym, content_type| writer_mock = double("writer") expect(writer_mock).to receive(:got_here) - expect(writer_class).to receive(:for).with(sym).and_return(writer_class) - writer_class.open("#{@basename}.#{sym}", format: sym) do |r| + expect(writer_class).to receive(:for).with(file_name: "#{@basename}.#{sym}").and_return(writer_class) + writer_class.open("#{@basename}.#{sym}") do |r| expect(r).to be_a(RDF::Writer) writer_mock.got_here end end end + it "yields writer given symbol" do + sym = format_class.to_sym # Like RDF::NTriples::Format => :ntriples + writer_mock = double("writer") + expect(writer_mock).to receive(:got_here) + expect(writer_class).to receive(:for).with(sym).and_return(writer_class) + writer_class.open("#{@basename}.#{sym}", format: sym) do |r| + expect(r).to be_a(RDF::Writer) + writer_mock.got_here + end + end + it "yields writer given {file_name: file_name}" do - writer_class.format.each do |f| - f.file_extensions.each_pair do |sym, content_type| - writer_mock = double("writer") - expect(writer_mock).to receive(:got_here) - expect(writer_class).to receive(:for).with(file_name: "#{@basename}.#{sym}").and_return(writer_class) - writer_class.open("#{@basename}.#{sym}", file_name: "#{@basename}.#{sym}") do |r| - expect(r).to be_a(RDF::Writer) - writer_mock.got_here - end + format_class.file_extensions.each_pair do |sym, content_type| + writer_mock = double("writer") + expect(writer_mock).to receive(:got_here) + expect(writer_class).to receive(:for).with(file_name: "#{@basename}.#{sym}").and_return(writer_class) + writer_class.open("#{@basename}.#{sym}", file_name: "#{@basename}.#{sym}") do |r| + expect(r).to be_a(RDF::Writer) + writer_mock.got_here end end end it "yields writer given {content_type: 'a/b'}" do - writer_class.format.each do |f| - f.content_types.each_pair do |content_type, formats| - writer_mock = double("writer") - expect(writer_mock).to receive(:got_here) - expect(writer_class).to receive(:for).with(content_type: content_type, file_name: @basename).and_return(writer_class) - writer_class.open(@basename, content_type: content_type) do |r| - expect(r).to be_a(RDF::Writer) - writer_mock.got_here - end + format_class.content_types.each_pair do |content_type, formats| + writer_mock = double("writer") + expect(writer_mock).to receive(:got_here) + expect(writer_class).to receive(:for).with(content_type: content_type, file_name: @basename).and_return(writer_class) + writer_class.open(@basename, content_type: content_type) do |r| + expect(r).to be_a(RDF::Writer) + writer_mock.got_here end end end From 9a7ace3c8d7e2de8936dcd7ae67634db9020f803 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 21 Feb 2017 14:20:59 -0800 Subject: [PATCH 03/16] Don't run reader open tests over all readers, just that being tested. --- lib/rdf/spec/reader.rb | 68 ++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/lib/rdf/spec/reader.rb b/lib/rdf/spec/reader.rb index 8e5a206..465a069 100644 --- a/lib/rdf/spec/reader.rb +++ b/lib/rdf/spec/reader.rb @@ -11,6 +11,7 @@ end let(:reader_class) { reader.class } + let(:format_class) { reader_class.format } describe ".each" do it "yields each reader" do @@ -21,61 +22,58 @@ end describe ".open" do - before(:each) do + it "yields reader given file_name" do allow(RDF::Util::File).to receive(:open_file).and_yield(StringIO.new(reader_input)) end it "yields reader given file_name" do reader_class.format.each do |f| - f.file_extensions.each_pair do |sym, content_type| - reader_mock = double("reader") - expect(reader_mock).to receive(:got_here) - expect(reader_class).to receive(:for).with(file_name: "foo.#{sym}").and_return(reader_class) - reader_class.open("foo.#{sym}") do |r| - expect(r).to be_a(RDF::Reader) - reader_mock.got_here + format_class.file_extensions.each_pair do |sym, content_type| + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + expect(RDF::Reader).to receive(:for).with(file_name: "foo.#{sym}").and_return(reader_class) + RDF::Reader.open("foo.#{sym}") do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here end end end end it "yields reader given symbol" do - reader_class.format.each do |f| - sym = f.to_sym # Like RDF::NTriples::Format => :ntriples - reader_mock = double("reader") - expect(reader_mock).to receive(:got_here) - expect(reader_class).to receive(:for).with(sym).and_return(reader_class) - reader_class.open("foo.#{sym}", format: sym) do |r| - expect(r).to be_a(RDF::Reader) - reader_mock.got_here - end + allow(RDF::Util::File).to receive(:open_file).and_yield(StringIO.new(reader_input)) + sym = format_class.to_sym # Like RDF::NTriples::Format => :ntriples + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + expect(RDF::Reader).to receive(:for).with(sym).and_return(reader_class) + RDF::Reader.open("foo.#{sym}", format: sym) do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here end end it "yields reader given {file_name: file_name}" do - reader_class.format.each do |f| - f.file_extensions.each_pair do |sym, content_type| - reader_mock = double("reader") - expect(reader_mock).to receive(:got_here) - expect(reader_class).to receive(:for).with(file_name: "foo.#{sym}").and_return(reader_class) - reader_class.open("foo.#{sym}", file_name: "foo.#{sym}") do |r| - expect(r).to be_a(RDF::Reader) - reader_mock.got_here - end + allow(RDF::Util::File).to receive(:open_file).and_yield(StringIO.new(reader_input)) + format_class.file_extensions.each_pair do |sym, content_type| + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + expect(RDF::Reader).to receive(:for).with(file_name: "foo.#{sym}").and_return(reader_class) + RDF::Reader.open("foo.#{sym}", file_name: "foo.#{sym}") do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here end end end it "yields reader given {content_type: 'a/b'}" do - reader_class.format.each do |f| - f.content_types.each_pair do |content_type, formats| - reader_mock = double("reader") - expect(reader_mock).to receive(:got_here) - expect(reader_class).to receive(:for).with(content_type: content_type, file_name: "foo").and_return(reader_class) - reader_class.open("foo", content_type: content_type) do |r| - expect(r).to be_a(RDF::Reader) - reader_mock.got_here - end + allow(RDF::Util::File).to receive(:open_file).and_yield(StringIO.new(reader_input)) + format_class.content_types.each_pair do |content_type, formats| + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + expect(RDF::Reader).to receive(:for).with(content_type: content_type, file_name: "foo").and_return(reader_class) + RDF::Reader.open("foo", content_type: content_type) do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here end end end From f066f05519a126597c57cc208f3464ddddf54527 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 21 Feb 2017 14:21:46 -0800 Subject: [PATCH 04/16] Verify that property Accept header is sent when a specific reader is determined in Reader.open. --- lib/rdf/spec/reader.rb | 65 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/lib/rdf/spec/reader.rb b/lib/rdf/spec/reader.rb index 465a069..b88eb6e 100644 --- a/lib/rdf/spec/reader.rb +++ b/lib/rdf/spec/reader.rb @@ -1,4 +1,5 @@ require 'rdf/spec' +require 'webmock/rspec' RSpec.shared_examples 'an RDF::Reader' do include RDF::Spec::Matchers @@ -24,10 +25,6 @@ describe ".open" do it "yields reader given file_name" do allow(RDF::Util::File).to receive(:open_file).and_yield(StringIO.new(reader_input)) - end - - it "yields reader given file_name" do - reader_class.format.each do |f| format_class.file_extensions.each_pair do |sym, content_type| reader_mock = double("reader") expect(reader_mock).to receive(:got_here) @@ -35,7 +32,6 @@ RDF::Reader.open("foo.#{sym}") do |r| expect(r).to be_a(reader_class) reader_mock.got_here - end end end end @@ -77,12 +73,67 @@ end end end + + it "yields reader when returned content_type matches" do + format_class.content_types.each_pair do |content_type, formats| + uri = "http://example/foo" + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + expect(RDF::Reader).to receive(:for).and_return(reader_class) + + WebMock.stub_request(:get, uri). + to_return(body: "BODY", + status: 200, + headers: { 'Content-Type' => content_type}) + + RDF::Reader.open(uri) do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here + end + end + end + + it "sets Accept header from reader" do + uri = "http://example/foo" + accept = (format_class.accept_type + %w(*/*;q=0.1)).join(", ") + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + WebMock.stub_request(:get, uri).with do |request| + expect(request.headers['Accept']).to eql accept + end.to_return(body: "foo") + + reader_class.open(uri) do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here + end + end + + it "sets Accept header from symbol" do + uri = "http://example/foo" + sym = format_class.to_sym # Like RDF::NTriples::Format => :ntriples + accept = (format_class.accept_type + %w(*/*;q=0.1)).join(", ") + reader_mock = double("reader") + expect(reader_mock).to receive(:got_here) + WebMock.stub_request(:get, uri).with do |request| + expect(request.headers['Accept']).to eql accept + end.to_return(body: "foo") + expect(RDF::Reader).to receive(:for).with(sym).and_return(reader_class) + + RDF::Reader.open(uri, format: sym) do |r| + expect(r).to be_a(reader_class) + reader_mock.got_here + end + end end describe ".format" do - it "returns itself even if given explicit format" do + it "returns a format class if given no format" do + expect(reader_class.format).not_to be_nil + end + + it "returns nil if given a format" do other_format = reader_class == RDF::NTriples::Reader ? :nquads : :ntriples - expect(reader_class.for(other_format)).to eq reader_class + expect(reader_class.format(other_format)).to be_nil end end From 66ac4f02685e89f4537255647fb435fc9b11b5eb Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 22 Feb 2017 14:28:30 -0800 Subject: [PATCH 05/16] Surround reader specs with disable/enable net connect. --- lib/rdf/spec/reader.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rdf/spec/reader.rb b/lib/rdf/spec/reader.rb index b88eb6e..42a4d10 100644 --- a/lib/rdf/spec/reader.rb +++ b/lib/rdf/spec/reader.rb @@ -10,6 +10,8 @@ raise 'reader_count must be defined with let(:reader_count)' unless defined? reader_count # define reader_invalid_input for invalid input end + before(:each) {WebMock.disable_net_connect!} + after(:each) {WebMock.allow_net_connect!} let(:reader_class) { reader.class } let(:format_class) { reader_class.format } From a7b06a253a52d741e2b898e687d61829820b0380 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 22 Feb 2017 14:48:30 -0800 Subject: [PATCH 06/16] Surround http_adapter specs with disable/enable net connect. --- lib/rdf/spec/http_adapter.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rdf/spec/http_adapter.rb b/lib/rdf/spec/http_adapter.rb index 2475e59..97ba7b8 100644 --- a/lib/rdf/spec/http_adapter.rb +++ b/lib/rdf/spec/http_adapter.rb @@ -9,6 +9,8 @@ raise '`http_adapter` must be defined with `let(:http_adapter`' unless defined? http_adapter end + before(:each) {WebMock.disable_net_connect!} + after(:each) {WebMock.allow_net_connect!} let(:uri) {"http://ruby-rdf.github.com/rdf/etc/doap.nt"} From 82295d604a8b1076bf81311e8f337314878103ea Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 31 Mar 2017 11:40:39 -0700 Subject: [PATCH 07/16] Use Travis "trusty" build and wildcard Ruby versions. --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f5b20ae..9e1f468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,15 @@ script: "bundle exec rspec spec" env: - CI=true rvm: - - 2.2.6 - - 2.3.3 - - 2.4.0 - - jruby - - rbx + - 2.2 + - 2.3 + - 2.4 + - jruby-9 + - rbx-3 cache: bundler sudo: false matrix: allow_failures: - - rvm: rbx - - rvm: jruby + - rvm: jruby-9 + - rvm: rbx-3 +dist: trusty From 581ad410b7a2d1df0a57fd8b946786eea5a3b35a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 31 Mar 2017 12:01:18 -0700 Subject: [PATCH 08/16] Change validation on Boolean, to reflect changes in RDF.rb. --- spec/literal_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/literal_spec.rb b/spec/literal_spec.rb index ae68552..559f025 100644 --- a/spec/literal_spec.rb +++ b/spec/literal_spec.rb @@ -15,8 +15,8 @@ %w(0 false) ] it_behaves_like 'RDF::Literal validation', RDF::XSD.boolean, - %w(true false tRuE FaLsE 1 0), - %w(foo 10) + %w(true false 1 0), + %w(foo 10) + ['true false', 'true foo', 'tRuE' 'FaLsE'] end describe RDF::Literal::Integer do From dd36d57b72e25a9b74a786db46c84ac3e079064b Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 7 Apr 2017 17:06:08 -0700 Subject: [PATCH 09/16] Add `WebMock.allow_net_connect!` when loading `rdf/spec`. --- lib/rdf/spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rdf/spec.rb b/lib/rdf/spec.rb index 5ee57be..df59677 100644 --- a/lib/rdf/spec.rb +++ b/lib/rdf/spec.rb @@ -3,6 +3,8 @@ require 'rspec' # @see http://rubygems.org/gems/rspec require 'rdf/spec/inspects' require 'rspec/its' +require 'webmock' +WebMock.allow_net_connect! module RDF ## From 64891d6d49602d7906403729437be27a836a2c3a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 21 Aug 2017 15:17:16 -0600 Subject: [PATCH 10/16] Replace rubyforge usage. --- etc/doap.nt | 2 +- etc/quads.nq | 2 +- etc/triples.nt | 2 +- rdf-spec.gemspec | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/etc/doap.nt b/etc/doap.nt index 752f1e4..59705b2 100644 --- a/etc/doap.nt +++ b/etc/doap.nt @@ -38,7 +38,7 @@ _:g70121455472480 "bedbbf2451e5beb38d59 . . . - . + . . . . diff --git a/etc/quads.nq b/etc/quads.nq index f1d5016..13db410 100644 --- a/etc/quads.nq +++ b/etc/quads.nq @@ -38,7 +38,7 @@ _:g70121455472480 "bedbbf2451e5beb38d59 . . . - . + . . . . diff --git a/etc/triples.nt b/etc/triples.nt index f608631..21f02d0 100644 --- a/etc/triples.nt +++ b/etc/triples.nt @@ -38,7 +38,7 @@ _:g70121455472480 "bedbbf2451e5beb38d59 . . . - . + . . . . diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 93551eb..f82d7af 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -10,7 +10,6 @@ Gem::Specification.new do |gem| gem.license = 'Unlicense' gem.summary = 'RSpec extensions for RDF.rb.' gem.description = 'RDF.rb extension that provides RSpec matchers and shared examples for RDF objects.' - gem.rubyforge_project = 'rdf' gem.authors = ['Arto Bendiken', 'Ben Lavender', 'Gregg Kellogg'] gem.email = 'public-rdf-ruby@w3.org' From 7e186ad0cd774a5a819c2bc1351c43f92a7b6a8c Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 21 Aug 2017 16:19:04 -0600 Subject: [PATCH 11/16] Update DOAP. --- etc/doap.nt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/doap.nt b/etc/doap.nt index 59705b2..c1b62a5 100644 --- a/etc/doap.nt +++ b/etc/doap.nt @@ -38,8 +38,8 @@ _:g70121455472480 "bedbbf2451e5beb38d59 . . . - . - . + . + . . . . From caf513bcf5486e015e01603f186a09410d9f01a4 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 25 Nov 2017 14:01:11 -0800 Subject: [PATCH 12/16] Update dependencies (webmock). (cherry picked from commit 89624234682c185e7e0e4399834c16c7bbeb6b0a) # Conflicts: # rdf-spec.gemspec --- rdf-spec.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index f82d7af..b1e0616 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -28,9 +28,9 @@ Gem::Specification.new do |gem| gem.requirements = [] gem.add_runtime_dependency 'rdf', '~> 2.2' gem.add_runtime_dependency 'rdf-isomorphic', '~> 2.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_runtime_dependency 'rspec', '~> 3.7' + gem.add_runtime_dependency 'rspec-its', '~> 1.2' + gem.add_runtime_dependency 'webmock', '~> 3.0' gem.add_development_dependency 'yard' , '~> 0.8' gem.post_install_message = nil end From 7b72c5af58d891756bff0175fc17e816feb72e65 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 13 Dec 2017 16:34:48 -0800 Subject: [PATCH 13/16] Feature/3.0 dev (#69) * 3.0 development branch; removes deprecation expectations. * Set version to 3.0.0, and soften dependencies to `>= 3.0', '< 4.0'. * Update dependencies (webmock). * Change Gemfile dep for rdf back to develop to prepare to merge back into develop branch. [ci skip] --- VERSION | 2 +- lib/rdf/spec/enumerable.rb | 12 ------------ rdf-spec.gemspec | 5 +++-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index ccbccc3..4a36342 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0 +3.0.0 diff --git a/lib/rdf/spec/enumerable.rb b/lib/rdf/spec/enumerable.rb index 4cf0d37..7e934e8 100644 --- a/lib/rdf/spec/enumerable.rb +++ b/lib/rdf/spec/enumerable.rb @@ -514,23 +514,11 @@ context "when converting" 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_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 context "when dumping" do diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index b1e0616..98671fc 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -26,8 +26,9 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] - gem.add_runtime_dependency 'rdf', '~> 2.2' - gem.add_runtime_dependency 'rdf-isomorphic', '~> 2.0' + gem.add_runtime_dependency 'rdf', '~> 3.0' + #gem.add_runtime_dependency 'rdf-isomorphic', '~> 3.0' + gem.add_runtime_dependency 'rdf-isomorphic', '>= 2.0', '< 4.0' gem.add_runtime_dependency 'rspec', '~> 3.7' gem.add_runtime_dependency 'rspec-its', '~> 1.2' gem.add_runtime_dependency 'webmock', '~> 3.0' From bf61d16ab2560a096c8a061fbf3ad39c4f1c46f0 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Thu, 21 Dec 2017 14:06:18 -0800 Subject: [PATCH 14/16] Update yard ~> 0.9.12 due to vulnerability. --- rdf-spec.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 98671fc..5552748 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -32,6 +32,6 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'rspec', '~> 3.7' gem.add_runtime_dependency 'rspec-its', '~> 1.2' gem.add_runtime_dependency 'webmock', '~> 3.0' - gem.add_development_dependency 'yard' , '~> 0.8' + gem.add_development_dependency 'yard' , '~> 0.9.12' gem.post_install_message = nil end From 733f3ee09f0316243f3315d842a4c20fe3a555d7 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 29 Dec 2017 16:24:09 -0800 Subject: [PATCH 15/16] Don't continually redefine `normalize` method in `be_equivalent_graph` matcher. --- lib/rdf/spec/matchers.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/rdf/spec/matchers.rb b/lib/rdf/spec/matchers.rb index f0445d0..9e05746 100644 --- a/lib/rdf/spec/matchers.rb +++ b/lib/rdf/spec/matchers.rb @@ -269,20 +269,6 @@ def io_name RSpec::Matchers.define :be_equivalent_graph do |expected, info| match do |actual| - def normalize(graph) - case graph - when RDF::Enumerable then graph - when IO, StringIO - RDF::Repository.new(graph, base_uri: @info.action) - else - # Figure out which parser to use - r = RDF::Repository.new - reader_class = RDF::Reader.for() {graph} - reader_class.new(graph, base_uri: @info.action).each {|s| r << s} - r - end - end - @info = if (info.id rescue false) info elsif info.is_a?(Logger) @@ -327,6 +313,20 @@ def normalize(graph) "Results:\n#{actual.dump(format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" + "\nDebug:\n#{@info.logger}" end + + def normalize(graph) + case graph + when RDF::Enumerable then graph + when IO, StringIO + RDF::Repository.new(graph, base_uri: @info.action) + else + # Figure out which parser to use + r = RDF::Repository.new + reader_class = RDF::Reader.for() {graph} + reader_class.new(graph, base_uri: @info.action).each {|s| r << s} + r + end + end end require 'json' From 9aa20fb58f9a066fe09e0f3fb044f45ab7625a91 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 29 Dec 2017 16:24:19 -0800 Subject: [PATCH 16/16] Update dependencies. --- .travis.yml | 2 ++ README.md | 4 ++-- rdf-spec.gemspec | 5 ++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e1f468..3e17ac6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,14 @@ language: ruby bundler_args: --without debug script: "bundle exec rspec spec" +before_install: "gem update --system" env: - CI=true rvm: - 2.2 - 2.3 - 2.4 + - 2.5 - jruby-9 - rbx-3 cache: bundler diff --git a/README.md b/README.md index 5361fe3..500695c 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) (~> 2.0) -* [RSpec](http://rubygems.org/gems/rspec) (~> 3.0) +* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0) +* [RSpec](http://rubygems.org/gems/rspec) (~> 3.7) ## Installation diff --git a/rdf-spec.gemspec b/rdf-spec.gemspec index 5552748..6519f41 100755 --- a/rdf-spec.gemspec +++ b/rdf-spec.gemspec @@ -27,11 +27,10 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] gem.add_runtime_dependency 'rdf', '~> 3.0' - #gem.add_runtime_dependency 'rdf-isomorphic', '~> 3.0' - gem.add_runtime_dependency 'rdf-isomorphic', '>= 2.0', '< 4.0' + gem.add_runtime_dependency 'rdf-isomorphic', '~> 3.0' gem.add_runtime_dependency 'rspec', '~> 3.7' gem.add_runtime_dependency 'rspec-its', '~> 1.2' - gem.add_runtime_dependency 'webmock', '~> 3.0' + gem.add_runtime_dependency 'webmock', '~> 3.1' gem.add_development_dependency 'yard' , '~> 0.9.12' gem.post_install_message = nil end