Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdf/model/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def eql?(other)
# @return [Integer]
# @see http://ruby-doc.org/core-2.2.2/Array.html#method-i-3C-3D-3E
def <=>(other)
to_a <=> other.to_a # TODO: optimize this
to_a <=> Array(other)
end

##
Expand Down
8 changes: 7 additions & 1 deletion spec/model_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@
it "returns 0 when given the same list" do
expect(ten).to eq ten
end

it "returns 0 when given the same list as array" do
expect(ten).to eq ten.to_a
end
end

describe "#==" do
Expand All @@ -591,8 +595,10 @@
expect(ten).not_to eq ten.statements.first
expect(ten).not_to eq RDF::Node.new
expect(ten).not_to eq RDF::Graph.new
expect(ten).not_to eq RDF::Literal.new('')
expect(ten).not_to eq Object.new
end

it "returns false when comparing to similar statements" do
statement = RDF::Statement(:s, :p, :o)
quasistatement = RDF::List[:s, :p, :o]
Expand Down