Skip to content

Commit

Permalink
Fix rspec deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbutler committed Sep 1, 2014
1 parent 24ee02b commit 76e5a83
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gemspec
Expand Up @@ -31,6 +31,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'rdf', '>= 1.1.0'
gem.add_development_dependency 'yard' , '>= 0.8.6'
gem.add_development_dependency 'rspec', '>= 2.14.0'
gem.add_development_dependency 'rspec-its'
gem.add_development_dependency 'rdf-spec', '>= 1.1.0'
gem.add_development_dependency 'rake'

Expand Down
6 changes: 3 additions & 3 deletions spec/format/graphviz_spec.rb
Expand Up @@ -19,7 +19,7 @@
RDF::Format.for(:file_extension => "dot"),
RDF::Format.for(:content_type => "text/vnd.graphviz"),
]
formats.each { |format| format.should == RDF::Raptor::Graphviz::Format }
formats.each { |format| expect(format).to eq(RDF::Raptor::Graphviz::Format) }
end
end

Expand All @@ -33,7 +33,7 @@
include RDF_Writer

it "should return :graphviz for to_sym" do
@writer_class.to_sym.should == :graphviz
expect(@writer_class.to_sym).to eq(:graphviz)
end

it "should be discoverable" do
Expand All @@ -44,7 +44,7 @@
RDF::Writer.for(:file_extension => "dot"),
RDF::Writer.for(:content_type => "text/vnd.graphviz"),
]
writers.each { |writer| writer.should == RDF::Raptor::Graphviz::Writer }
writers.each { |writer| expect(writer).to eq(RDF::Raptor::Graphviz::Writer) }
end
end

Expand Down
42 changes: 21 additions & 21 deletions spec/format/ntriples_spec.rb
Expand Up @@ -20,7 +20,7 @@
RDF::Format.for(:content_type => "text/plain"),
RDF::Format.for(:content_type => "application/n-triples"),
]
formats.each { |format| format.should == @format_class }
formats.each { |format| expect(format).to eq(@format_class) }
end

{
Expand All @@ -29,7 +29,7 @@
:multi_line => %(<a>\n <b>\n "literal"\n .),
}.each do |sym, str|
it "detects #{sym}" do
@format_class.for {str}.should == @format_class
expect(@format_class.for {str}).to eq(@format_class)
end
end

Expand All @@ -40,7 +40,7 @@
:multi_line => %(<a>\n <b>\n "literal"\n .),
}.each do |sym, str|
it "detects #{sym}" do
@format_class.detect(str).should be_true
expect(@format_class.detect(str)).to be true
end
end

Expand All @@ -54,7 +54,7 @@
:n3 => '@prefix foo: <bar> .\nfoo:bar = {<a> <b> <c>} .',
}.each do |sym, str|
it "does not detect #{sym}" do
@format_class.detect(str).should be_false
expect(@format_class.detect(str)).to be false
end
end
end
Expand All @@ -73,7 +73,7 @@
include RDF_Reader

it "should return :ntriples for to_sym" do
@reader.class.to_sym.should == :ntriples
expect(@reader.class.to_sym).to eq(:ntriples)
end

it "should be discoverable" do
Expand All @@ -85,49 +85,49 @@
RDF::Reader.for(:content_type => "text/plain"),
RDF::Reader.for(:content_type => "application/n-triples"),
]
readers.each { |reader| reader.should == RDF::Raptor::NTriples::Reader }
readers.each { |reader| expect(reader).to eq(RDF::Raptor::NTriples::Reader) }
end

it 'should yield statements' do
inner = double("inner")
inner.should_receive(:called).with(RDF::Statement).twice
expect(inner).to receive(:called).with(RDF::Statement).twice
@reader.each_statement do |statement|
inner.called(statement.class)
end
end

it 'should yield raw statements' do
@reader.each_statement(:raw => true) do |statement|
statement.should be_a RDF::Raptor::FFI::V2::Statement
expect(statement).to be_a RDF::Raptor::FFI::V2::Statement
end
end

it "should yield triples" do
inner = double("inner")
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::URI).once
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).once
expect(inner).to receive(:called).with(RDF::URI, RDF::URI, RDF::URI).once
expect(inner).to receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).once
@reader.each_triple do |subject, predicate, object|
inner.called(subject.class, predicate.class, object.class)
end
end

it "should open and parse a file" do
RDF::Reader.open("etc/doap.nt") do |reader|
reader.should be_a subject.class
reader.count.should be > 0
expect(reader).to be_a subject.class
expect(reader.count).to be > 0
end
end

it "should parse a URI" do
reader = RDF::Raptor::NTriples::Reader.new
result = reader.parse("http://dbpedia.org/data/Michael_Jackson.ntriples")
result.should == 0
expect(result).to eq(0)
end

it "should parse a String" do
reader = RDF::Raptor::NTriples::Reader.new
result = reader.parse(@reader_input)
result.should == 0
expect(result).to eq(0)
end
end

Expand All @@ -141,7 +141,7 @@
include RDF_Writer

it "should return :ntriples for to_sym" do
@writer_class.to_sym.should == :ntriples
expect(@writer_class.to_sym).to eq(:ntriples)
end

it "should be discoverable" do
Expand All @@ -153,7 +153,7 @@
RDF::Writer.for(:content_type => "text/plain"),
RDF::Writer.for(:content_type => "application/n-triples"),
]
writers.each { |writer| writer.should == RDF::Raptor::NTriples::Writer }
writers.each { |writer| expect(writer).to eq(RDF::Raptor::NTriples::Writer) }
end
end

Expand Down Expand Up @@ -207,26 +207,26 @@

it "should output statements to a string buffer" do
output = @writer.buffer { |writer| writer << @stmt }
output.should == "#{@stmt_string}\n"
expect(output).to eq("#{@stmt_string}\n")
end

it "should dump statements to a string buffer" do
output = StringIO.new
@writer.dump(@graph, output)
output.string.should == "#{@stmt_string}\n"
expect(output.string).to eq("#{@stmt_string}\n")
end

it "should dump arrays of statements to a string buffer" do
output = StringIO.new
@writer.dump(@graph.to_a, output)
output.string.should == "#{@stmt_string}\n"
expect(output.string).to eq("#{@stmt_string}\n")
end

it "should dump statements to a file" do
require 'tmpdir' # for Dir.tmpdir
@writer.dump(@graph, filename = File.join(Dir.tmpdir, "test.nt"))
File.read(filename).should == "#{@stmt_string}\n"
expect(File.read(filename)).to eq("#{@stmt_string}\n")
File.unlink(filename)
end
end
end
end
13 changes: 6 additions & 7 deletions spec/format/rdfa_spec.rb
Expand Up @@ -19,7 +19,7 @@
RDF::Format.for(:file_extension => "html"),
RDF::Format.for(:content_type => "application/xhtml+xml"),
]
formats.each { |format| format.should == RDF::Raptor::RDFa::Format }
formats.each { |format| expect(format).to eq(RDF::Raptor::RDFa::Format) }
end
end

Expand All @@ -38,7 +38,7 @@
#include RDF_Reader

it "should return :rdfa for to_sym" do
@reader.class.to_sym.should == :rdfa
expect(@reader.class.to_sym).to eq(:rdfa)
end

it "should be discoverable" do
Expand All @@ -49,7 +49,7 @@
RDF::Reader.for(:file_extension => "html"),
RDF::Reader.for(:content_type => "application/xhtml+xml"),
]
readers.each { |reader| reader.should == RDF::Raptor::RDFa::Reader }
readers.each { |reader| expect(reader).to eq(RDF::Raptor::RDFa::Reader) }
end

context "when opening and parsing a file" do
Expand All @@ -65,9 +65,8 @@
end

it "reads HTML5 prefixes" do
pending 'libraptor does not support prefixes for HTML 5 + RDFa 1.1' do
expect(reader.prefixes[:doap]).to eq(RDF::DOAP)
end
pending 'libraptor does not support prefixes for HTML 5 + RDFa 1.1'
expect(reader.prefixes[:doap]).to eq(RDF::DOAP)
end
end
end
end
16 changes: 8 additions & 8 deletions spec/format/rdfxml_spec.rb
Expand Up @@ -18,7 +18,7 @@
RDF::Format.for(:file_extension => "rdf"),
RDF::Format.for(:content_type => "application/rdf+xml"),
]
formats.each { |format| format.should == RDF::Raptor::RDFXML::Format }
formats.each { |format| expect(format).to eq(RDF::Raptor::RDFXML::Format) }
end
end

Expand All @@ -42,10 +42,10 @@
RDF::Reader.for(:file_extension => "rdf"),
RDF::Reader.for(:content_type => "application/rdf+xml"),
]
readers.each { |reader| reader.should == RDF::Raptor::RDFXML::Reader }
readers.each { |reader| expect(reader).to eq(RDF::Raptor::RDFXML::Reader) }
end

context :interface do
context 'interface' do
before(:each) do
@reader = RDF::Raptor::RDFXML::Reader.new(%q(<?xml version="1.0" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Expand All @@ -58,21 +58,21 @@
end

it "should return reader" do
@reader.should be_a(RDF::Raptor::RDFXML::Reader)
expect(@reader).to be_a(RDF::Raptor::RDFXML::Reader)
end

it "should yield statements" do
inner = double("inner")
inner.should_receive(:called).with(RDF::Statement).exactly(4).times
expect(inner).to receive(:called).with(RDF::Statement).exactly(4).times
@reader.each_statement do |statement|
inner.called(statement.class)
end
end

it "should yield triples" do
inner = double("inner")
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::URI).twice
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).twice
expect(inner).to receive(:called).with(RDF::URI, RDF::URI, RDF::URI).twice
expect(inner).to receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).twice
@reader.each_triple do |subject, predicate, object|
inner.called(subject.class, predicate.class, object.class)
end
Expand Down Expand Up @@ -111,6 +111,6 @@
RDF::Writer.for(:file_extension => "rdf"),
RDF::Writer.for(:content_type => "application/rdf+xml"),
]
writers.each { |writer| writer.should == RDF::Raptor::RDFXML::Writer }
writers.each { |writer| expect(writer).to eq(RDF::Raptor::RDFXML::Writer) }
end
end
10 changes: 5 additions & 5 deletions spec/format/turtle_spec.rb
Expand Up @@ -19,7 +19,7 @@
RDF::Format.for(:file_extension => "ttl"),
RDF::Format.for(:content_type => "text/turtle"),
]
formats.each { |format| format.should == RDF::Raptor::Turtle::Format }
formats.each { |format| expect(format).to eq(RDF::Raptor::Turtle::Format) }
end
end

Expand All @@ -37,7 +37,7 @@
include RDF_Reader

it "should return :turtle for to_sym" do
@reader.class.to_sym.should == :turtle
expect(@reader.class.to_sym).to eq(:turtle)
end

it "should be discoverable" do
Expand All @@ -48,7 +48,7 @@
RDF::Reader.for(:file_extension => "ttl"),
RDF::Reader.for(:content_type => "text/turtle"),
]
readers.each { |reader| reader.should == RDF::Raptor::Turtle::Reader }
readers.each { |reader| expect(reader).to eq(RDF::Raptor::Turtle::Reader) }
end

it "opens and parses a file" do
Expand All @@ -70,7 +70,7 @@
include RDF_Writer

it "should return :ttl for to_sym" do
@writer_class.to_sym.should == :turtle
expect(@writer_class.to_sym).to eq(:turtle)
end

it "should be discoverable" do
Expand All @@ -81,7 +81,7 @@
RDF::Writer.for(:file_extension => "ttl"),
RDF::Writer.for(:content_type => "text/turtle"),
]
writers.each { |writer| writer.should == RDF::Raptor::Turtle::Writer }
writers.each { |writer| expect(writer).to eq(RDF::Raptor::Turtle::Writer) }
end

it "should not use pname URIs without prefix" do
Expand Down
6 changes: 3 additions & 3 deletions spec/raptor_cli_spec.rb
Expand Up @@ -6,13 +6,13 @@
describe RDF::Raptor, :cli => true do
it 'should load the CLI engine' do
#subject.ENGINE.should eql(:cli)
subject.included_modules.should include(RDF::Raptor::CLI)
subject.included_modules.should_not include(RDF::Raptor::FFI)
expect(subject.included_modules).to include(RDF::Raptor::CLI)
expect(subject.included_modules).not_to include(RDF::Raptor::FFI)
end
end

describe RDF::Raptor::CLI, :cli => true do
it 'should return the libraptor version' do
RDF::Raptor.version.should_not be_nil
expect(RDF::Raptor.version).not_to be_nil
end
end
6 changes: 3 additions & 3 deletions spec/raptor_ffi_spec.rb
Expand Up @@ -5,13 +5,13 @@
describe RDF::Raptor do
it 'should load the FFI engine' do
#subject.ENGINE.should eql(:ffi)
subject.included_modules.should include(RDF::Raptor::FFI)
subject.included_modules.should_not include(RDF::Raptor::CLI)
expect(subject.included_modules).to include(RDF::Raptor::FFI)
expect(subject.included_modules).not_to include(RDF::Raptor::CLI)
end
end

describe RDF::Raptor::FFI do
it 'should return the libraptor version' do
RDF::Raptor.version.should_not be_nil
expect(RDF::Raptor.version).not_to be_nil
end
end
6 changes: 3 additions & 3 deletions spec/raptor_spec.rb
Expand Up @@ -2,10 +2,10 @@

describe RDF::Raptor do
it 'should return the libraptor version' do
subject.version.should_not be_nil
expect(subject.version).not_to be_nil
end

it 'should be available' do
subject.available?.should be_true
expect(subject.available?).to be true
end
end
end
2 changes: 1 addition & 1 deletion spec/version_spec.rb
Expand Up @@ -2,6 +2,6 @@

describe 'RDF::Raptor::VERSION' do
it "should match the VERSION file" do
RDF::Raptor::VERSION.to_s.should == File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp
expect(RDF::Raptor::VERSION.to_s).to eq(File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp)
end
end

0 comments on commit 76e5a83

Please sign in to comment.