Skip to content

Commit

Permalink
Finish 2.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Apr 15, 2017
2 parents 2ee5565 + 56a1373 commit cc980e5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: jruby
- rvm: rbx
- rvm: jruby-9
- rvm: rbx-3
dist: trusty
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ group :debug do
gem "redcarpet", platforms: :ruby
gem "byebug", platforms: :mri
gem 'rubinius-debugger', platform: :rbx
gem 'ruby-debug', platform: :jruby
gem 'guard-rspec'
end

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.5
2.2.6
8 changes: 4 additions & 4 deletions lib/rdf/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class << self
# @yieldreturn [void] ignored
# @raise [RDF::FormatError] if no reader found for the specified format
def self.open(filename, format: nil, **options, &block)
# If we're the abstract reader, and we can figure out a concrete reader from format and options, use that.
if self == RDF::Reader && reader = self.for(format || {file_name: filename}.merge(options))
# If we're the abstract reader, and we can figure out a concrete reader from format, use that.
if self == RDF::Reader && format && reader = self.for(format)
return reader.open(filename, format: format, **options, &block)
end

Expand Down Expand Up @@ -383,7 +383,7 @@ def each_statement(&block)
if block_given?
begin
loop { block.call(read_statement) }
rescue EOFError => e
rescue EOFError
rewind rescue nil
end
end
Expand Down Expand Up @@ -417,7 +417,7 @@ def each_triple(&block)
if block_given?
begin
loop { block.call(*read_triple) }
rescue EOFError => e
rescue EOFError
rewind rescue nil
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/ntriples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@
end

describe "BNodes" do
it "should read two named nodes as the same node" do
it "should read two named nodes as the same node", pending: ("#to_ary messing with JRuby" if RUBY_ENGINE == 'jruby') do
stmt = reader.new("_:a <http://www.w3.org/2002/07/owl#sameAs> _:a .".freeze).first
expect(stmt.subject).to eq stmt.object
expect(stmt.subject).to be_eql(stmt.object)
end

it "should read two named nodes in different instances as different nodes" do
it "should read two named nodes in different instances as different nodes", pending: ("#to_ary messing with JRuby" if RUBY_ENGINE == 'jruby') do
stmt1 = reader.new("_:a <http://www.w3.org/2002/07/owl#sameAs> _:a .".freeze).first
stmt2 = reader.new("_:a <http://www.w3.org/2002/07/owl#sameAs> _:a .".freeze).first
expect(stmt1.subject).to eq stmt2.subject
Expand All @@ -300,7 +300,7 @@
"é" => '<http://subj> <http://pred> "\u00E9" .',
"€" => '<http://subj> <http://pred> "\u20AC" .',
}.each_pair do |contents, triple|
specify "test #{contents}" do
specify "test #{contents}", pending: ("#to_ary messing with JRuby" if RUBY_ENGINE == 'jruby') do
stmt = reader.new(triple).first
expect(stmt.object.value).to eq contents
ttl = RDF::Turtle::Reader.new(triple).first
Expand Down
15 changes: 15 additions & 0 deletions spec/reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,20 @@
reader_mock.got_here
end
end

it "uses content type in preference to file extension" do
uri = "http://example/foo.nq"
accept = (RDF::Format.accept_types + %w(*/*;q=0.1)).join(", ")
reader_mock = double("reader")
expect(reader_mock).to receive(:got_here)
WebMock.
stub_request(:get, uri).
to_return(body: "foo", status: 200, headers: { 'Content-Type' => 'text/turtle'})

described_class.open(uri) do |r|
expect(r).to be_a(RDF::Turtle::Reader)
reader_mock.got_here
end
end
end
end

0 comments on commit cc980e5

Please sign in to comment.