Skip to content

Commit cc980e5

Browse files
committed
Finish 2.2.6
2 parents 2ee5565 + 56a1373 commit cc980e5

6 files changed

Lines changed: 32 additions & 15 deletions

File tree

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ script: "bundle exec rspec spec"
44
env:
55
- CI=true
66
rvm:
7-
- 2.2.6
8-
- 2.3.3
9-
- 2.4.0
10-
- jruby
11-
- rbx
7+
- 2.2
8+
- 2.3
9+
- 2.4
10+
- jruby-9
11+
- rbx-3
1212
cache: bundler
1313
sudo: false
1414
matrix:
1515
allow_failures:
16-
- rvm: jruby
17-
- rvm: rbx
16+
- rvm: jruby-9
17+
- rvm: rbx-3
18+
dist: trusty

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ group :debug do
1919
gem "redcarpet", platforms: :ruby
2020
gem "byebug", platforms: :mri
2121
gem 'rubinius-debugger', platform: :rbx
22+
gem 'ruby-debug', platform: :jruby
2223
gem 'guard-rspec'
2324
end
2425

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.5
1+
2.2.6

lib/rdf/reader.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ class << self
180180
# @yieldreturn [void] ignored
181181
# @raise [RDF::FormatError] if no reader found for the specified format
182182
def self.open(filename, format: nil, **options, &block)
183-
# If we're the abstract reader, and we can figure out a concrete reader from format and options, use that.
184-
if self == RDF::Reader && reader = self.for(format || {file_name: filename}.merge(options))
183+
# If we're the abstract reader, and we can figure out a concrete reader from format, use that.
184+
if self == RDF::Reader && format && reader = self.for(format)
185185
return reader.open(filename, format: format, **options, &block)
186186
end
187187

@@ -383,7 +383,7 @@ def each_statement(&block)
383383
if block_given?
384384
begin
385385
loop { block.call(read_statement) }
386-
rescue EOFError => e
386+
rescue EOFError
387387
rewind rescue nil
388388
end
389389
end
@@ -417,7 +417,7 @@ def each_triple(&block)
417417
if block_given?
418418
begin
419419
loop { block.call(*read_triple) }
420-
rescue EOFError => e
420+
rescue EOFError
421421
rewind rescue nil
422422
end
423423
end

spec/ntriples_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@
272272
end
273273

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

281-
it "should read two named nodes in different instances as different nodes" do
281+
it "should read two named nodes in different instances as different nodes", pending: ("#to_ary messing with JRuby" if RUBY_ENGINE == 'jruby') do
282282
stmt1 = reader.new("_:a <http://www.w3.org/2002/07/owl#sameAs> _:a .".freeze).first
283283
stmt2 = reader.new("_:a <http://www.w3.org/2002/07/owl#sameAs> _:a .".freeze).first
284284
expect(stmt1.subject).to eq stmt2.subject
@@ -300,7 +300,7 @@
300300
"é" => '<http://subj> <http://pred> "\u00E9" .',
301301
"€" => '<http://subj> <http://pred> "\u20AC" .',
302302
}.each_pair do |contents, triple|
303-
specify "test #{contents}" do
303+
specify "test #{contents}", pending: ("#to_ary messing with JRuby" if RUBY_ENGINE == 'jruby') do
304304
stmt = reader.new(triple).first
305305
expect(stmt.object.value).to eq contents
306306
ttl = RDF::Turtle::Reader.new(triple).first

spec/reader_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,20 @@
5656
reader_mock.got_here
5757
end
5858
end
59+
60+
it "uses content type in preference to file extension" do
61+
uri = "http://example/foo.nq"
62+
accept = (RDF::Format.accept_types + %w(*/*;q=0.1)).join(", ")
63+
reader_mock = double("reader")
64+
expect(reader_mock).to receive(:got_here)
65+
WebMock.
66+
stub_request(:get, uri).
67+
to_return(body: "foo", status: 200, headers: { 'Content-Type' => 'text/turtle'})
68+
69+
described_class.open(uri) do |r|
70+
expect(r).to be_a(RDF::Turtle::Reader)
71+
reader_mock.got_here
72+
end
73+
end
5974
end
6075
end

0 commit comments

Comments
 (0)