Skip to content

Commit dc7805f

Browse files
committed
Release 1.1.1.
* Updates for RDF.rb v1.1.5.
2 parents 5851b93 + 29664f0 commit dc7805f

14 files changed

Lines changed: 97 additions & 110 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/.yardoc
55
/user-test-cases
66
/.rbx/
7+
/spec/w3c-rdf
78
Gemfile.lock

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ env:
55
- CI=true
66
rvm:
77
- 1.9.3
8-
- 2.0.0
9-
- 2.1.0
8+
- 2.0
9+
- 2.1
1010
- jruby-19mode
11-
- rbx
11+
- rbx-2
1212
env:
1313
global:
1414
- CI=true

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ group :debug do
1818
gem "wirble"
1919
gem "ruby-debug", :platforms => :jruby
2020
gem "debugger", :platforms => :mri_19
21-
gem "byebug", :platforms => :mri_20
21+
gem "byebug", :platforms => [:mri_20, :mri_21]
2222
end
2323

2424
platforms :rbx do

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0.1
1+
1.1.1

lib/rdf/rdfxml/writer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def render_property(predicate, objects, options = {}, &block)
230230

231231
# Separate out the objects which are lists and render separately
232232
lists = objects.
233+
select(&:node?).
233234
map {|o| RDF::List.new(o, @graph)}.
234235
select {|l| l.valid? && l.none?(&:literal?)}
235236

rdf-rdfxml.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ Gem::Specification.new do |gem|
2929

3030
#gem.add_development_dependency 'nokogiri' , '>= 1.6.1' # conditionally done in Gemfile
3131
gem.add_development_dependency 'equivalent-xml' , '~> 0.2'
32+
gem.add_development_dependency 'open-uri-cached', '~> 0.0', '>= 0.0.5'
3233
gem.add_development_dependency 'spira', '= 0.0.12'
3334
gem.add_development_dependency 'json-ld', '~> 1.1'
34-
gem.add_development_dependency 'rspec', '~> 2.14'
35+
gem.add_development_dependency 'rspec', '~> 3.0'
36+
gem.add_development_dependency 'rspec-its', '~> 1.0'
3537
gem.add_development_dependency 'rdf-isomorphic', '~> 1.1'
3638
gem.add_development_dependency 'rdf-turtle', '~> 1.1'
3739
gem.add_development_dependency 'rdf-spec', '~> 1.1'

spec/format_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@
1818
{:content_type => 'application/rdf+xml'},
1919
].each do |arg|
2020
it "discovers with #{arg.inspect}" do
21-
RDF::Format.for(arg).should == @format_class
21+
expect(RDF::Format.for(arg)).to eq @format_class
2222
end
2323
end
2424

2525
{
2626
:rdfxml => '<rdf:RDF about="foo"></rdf:RDF>',
2727
}.each do |sym, str|
2828
it "detects #{sym}" do
29-
@format_class.for {str}.should == @format_class
29+
expect(@format_class.for {str}).to eq @format_class
3030
end
3131
end
3232
end
3333

3434
describe "#to_sym" do
35-
specify {@format_class.to_sym.should == :rdfxml}
35+
specify {expect(@format_class.to_sym).to eq :rdfxml}
3636
end
3737

3838
describe ".detect" do
3939
{
4040
:rdfxml => '<rdf:RDF about="foo"></rdf:RDF>',
4141
}.each do |sym, str|
4242
it "detects #{sym}" do
43-
@format_class.detect(str).should be_true
43+
expect(@format_class.detect(str)).to be_truthy
4444
end
4545
end
4646

@@ -59,18 +59,18 @@
5959
:STRING_LITERAL_LONG2 => %(<a> <b> """\nliteral\n""" .),
6060
}.each do |sym, str|
6161
it "does not detect #{sym}" do
62-
@format_class.detect(str).should be_false
62+
expect(@format_class.detect(str)).to be_falsey
6363
end
6464
end
6565

6666
describe RDF::RDFXML::RDFFormat do
6767
it "discovers with :rdf" do
68-
RDF::Format.for(:rdf).should == RDF::RDFXML::RDFFormat
68+
expect(RDF::Format.for(:rdf)).to eq RDF::RDFXML::RDFFormat
6969
end
7070

7171
it "should discover :rdf" do
72-
RDF::Format.for(:rdf).reader.should == RDF::RDFXML::Reader
73-
RDF::Format.for(:rdf).writer.should == RDF::RDFXML::Writer
72+
expect(RDF::Format.for(:rdf).reader).to eq RDF::RDFXML::Reader
73+
expect(RDF::Format.for(:rdf).writer).to eq RDF::RDFXML::Writer
7474
end
7575
end
7676
end

spec/jruby_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
describe Nokogiri::XML do
99
describe "parse" do
1010
it "parses namespaced elements without a namespace" do
11-
Nokogiri::XML.parse("<dc:sup>bar</dc:sup>").root.should_not be_nil
11+
expect(Nokogiri::XML.parse("<dc:sup>bar</dc:sup>").root).not_to be_nil
1212
end
1313
end
1414
end
@@ -25,7 +25,7 @@
2525
"/rdf:RDF/rdf:Description/@dc:title" => "foo"
2626
}.each do |path, value|
2727
it "returns #{value.inspect} for xpath #{path}" do
28-
subject.should have_xpath(path, value, {})
28+
expect(subject).to have_xpath(path, value, {})
2929
end
3030
end
3131
end

spec/matchers.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
RSpec::Matchers.define :have_xpath do |xpath, value, namespaces, trace|
44
match do |actual|
55
@doc = Nokogiri::XML.parse(actual)
6-
@doc.should be_a(Nokogiri::XML::Document)
7-
@doc.root.should be_a(Nokogiri::XML::Element)
6+
return false unless @doc.is_a?(Nokogiri::XML::Document)
7+
return false unless @doc.root.is_a?(Nokogiri::XML::Element)
88
@namespaces = @doc.namespaces.inject({}) {|memo, (k,v)| memo[k.to_s.sub(/xmlns:?/, '')] = v; memo}.
99
merge(namespaces).
1010
merge("xhtml" => "http://www.w3.org/1999/xhtml", "xml" => "http://www.w3.org/XML/1998/namespace")
1111
@result = @doc.root.at_xpath(xpath, @namespaces) rescue false
1212
case value
1313
when false
14-
@result.should be_nil
14+
@result.nil?
1515
when true
16-
@result.should_not be_nil
16+
!@result.nil?
1717
when Array
18-
@result.to_s.split(" ").should include(*value)
18+
@result.to_s.split(" ").include?(*value)
1919
when Regexp
20-
@result.to_s.should =~ value
20+
@result.to_s =~ value
2121
else
22-
@result.to_s.should == value
22+
@result.to_s. == value
2323
end
2424
end
2525

26-
failure_message_for_should do |actual|
26+
failure_message_when_negated do |actual|
2727
msg = "expected to that #{xpath.inspect} would be #{value.inspect} in:\n" + actual.to_s
2828
msg += "was: #{@result}"
2929
msg += "\nDebug:#{trace.join("\n")}" if trace
@@ -69,7 +69,7 @@ def normalize(graph)
6969
@actual.isomorphic_with?(@expected) rescue false
7070
end
7171

72-
failure_message_for_should do |actual|
72+
failure_message do |actual|
7373
info = @info.respond_to?(:comment) ? @info.comment : @info.inspect
7474
if @expected.is_a?(RDF::Graph) && @actual.size != @expected.size
7575
"Graph entry count differs:\nexpected: #{@expected.size}\nactual: #{@actual.size}"
@@ -89,10 +89,10 @@ def normalize(graph)
8989

9090
RSpec::Matchers.define :produce do |expected, info|
9191
match do |actual|
92-
actual.should == expected
92+
actual == expected
9393
end
9494

95-
failure_message_for_should do |actual|
95+
failure_message do |actual|
9696
"Expected: #{[Array, Hash].include?(expected.class) ? expected.to_json(JSON_STATE) : expected.inspect}\n" +
9797
"Actual : #{[Array, Hash].include?(actual.class) ? actual.to_json(JSON_STATE) : actual.inspect}\n" +
9898
#(expected.is_a?(Hash) && actual.is_a?(Hash) ? "Diff: #{expected.diff(actual).to_json(JSON_STATE)}\n" : "") +

spec/reader_spec.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"application/rdf+xml" => RDF::Reader.for(:content_type => "application/rdf+xml"),
2828
}.each_pair do |label, format|
2929
it "should discover '#{label}'" do
30-
format.should == RDF::RDFXML::Reader
30+
expect(format).to eq RDF::RDFXML::Reader
3131
end
3232
end
3333
end
@@ -52,27 +52,27 @@
5252

5353
it "should yield reader" do
5454
inner = double("inner")
55-
inner.should_receive(:called).with(RDF::RDFXML::Reader)
55+
expect(inner).to receive(:called).with(RDF::RDFXML::Reader)
5656
RDF::RDFXML::Reader.new(@sampledoc) do |reader|
5757
inner.called(reader.class)
5858
end
5959
end
6060

6161
it "should return reader" do
62-
RDF::RDFXML::Reader.new(@sampledoc).should be_a(RDF::RDFXML::Reader)
62+
expect(RDF::RDFXML::Reader.new(@sampledoc)).to be_a(RDF::RDFXML::Reader)
6363
end
6464

6565
it "should yield statements" do
6666
inner = double("inner")
67-
inner.should_receive(:called).with(RDF::Statement).twice
67+
expect(inner).to receive(:called).with(RDF::Statement).twice
6868
RDF::RDFXML::Reader.new(@sampledoc).each_statement do |statement|
6969
inner.called(statement.class)
7070
end
7171
end
7272

7373
it "should yield triples" do
7474
inner = double("inner")
75-
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).twice
75+
expect(inner).to receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).twice
7676
RDF::RDFXML::Reader.new(@sampledoc).each_triple do |subject, predicate, object|
7777
inner.called(subject.class, predicate.class, object.class)
7878
end
@@ -88,11 +88,11 @@
8888
sampledoc = %(<?xml version="1.0" ?>
8989
<NotRDF />)
9090
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
91-
graph.size.should == 1
91+
expect(graph.size).to eq 1
9292
statement = graph.statements.first
93-
statement.subject.class.should == RDF::Node
94-
statement.predicate.should == RDF.type
95-
statement.object.should == RDF::XML.NotRDF
93+
expect(statement.subject.class).to eq RDF::Node
94+
expect(statement.predicate).to eq RDF.type
95+
expect(statement.object).to eq RDF::XML.NotRDF
9696
end
9797

9898
it "should parse on XML documents with multiple RDF nodes" do
@@ -112,7 +112,7 @@
112112
</GenericXML>)
113113
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
114114
objects = graph.statements.map {|s| s.object.value}.sort
115-
objects.should == ["Bar", "Foo"]
115+
expect(objects).to include("Bar", "Foo")
116116
end
117117

118118
it "should be able to parse a simple single-triple document" do
@@ -156,7 +156,7 @@
156156
<http://www.example.org/name> "Tom"@en] .
157157
)
158158
graph = parse(sampledoc, :base_uri => "http://example.com/", :validate => true)
159-
graph.should be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
159+
expect(graph).to be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
160160
end
161161

162162
it "should be able to handle Bags/Alts etc." do
@@ -168,7 +168,7 @@
168168
</rdf:Bag>
169169
</rdf:RDF>)
170170
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
171-
graph.predicates.map(&:to_s).should include("http://www.w3.org/1999/02/22-rdf-syntax-ns#_1", "http://www.w3.org/1999/02/22-rdf-syntax-ns#_2")
171+
expect(graph.predicates.map(&:to_s)).to include("http://www.w3.org/1999/02/22-rdf-syntax-ns#_1", "http://www.w3.org/1999/02/22-rdf-syntax-ns#_2")
172172
end
173173
end
174174

@@ -199,7 +199,7 @@
199199
<http://example.net/> <http://purl.org/dc/terms/title> "Test 0304"@fr .
200200
)
201201
graph = parse(svg, :base_uri => "http://example.com/", :validate => true)
202-
graph.should be_equivalent_graph(expected, :trace => @debug)
202+
expect(graph).to be_equivalent_graph(expected, :trace => @debug)
203203
end
204204

205205
context :exceptions do
@@ -316,7 +316,7 @@
316316
)
317317

318318
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
319-
graph.should be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
319+
expect(graph).to be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
320320
end
321321
end
322322

@@ -343,7 +343,7 @@
343343
)
344344

345345
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
346-
graph.should be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
346+
expect(graph).to be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
347347
end
348348

349349
it "decodes element content" do
@@ -362,7 +362,7 @@
362362
)
363363

364364
graph = parse(sampledoc, :base_uri => "http://example.com", :validate => true)
365-
graph.should be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
365+
expect(graph).to be_equivalent_graph(expected, :about => "http://example.com/", :trace => @debug)
366366
end
367367
end
368368
end

0 commit comments

Comments
 (0)