diff --git a/lib/neography/node_traverser.rb b/lib/neography/node_traverser.rb index 18b1d46..9ef9b7a 100644 --- a/lib/neography/node_traverser.rb +++ b/lib/neography/node_traverser.rb @@ -121,7 +121,7 @@ def iterator options["depth"] = @depth unless @depth.nil? if @relationships[0]["type"].empty? - rels = @from.neo_server.get_node_relationships(@from, @relationships[0]["direction"]) + rels = @from.neo_server.get_node_relationships(@from, @relationships[0]["direction"]) || [] case @relationships[0]["direction"] when "in" rels.collect { |r| @from.neo_server.get_node(r["start"]) } #.uniq diff --git a/spec/integration/node_relationship_spec.rb b/spec/integration/node_relationship_spec.rb index f410d2c..3fef3b1 100644 --- a/spec/integration/node_relationship_spec.rb +++ b/spec/integration/node_relationship_spec.rb @@ -157,6 +157,11 @@ def create_nodes b.outgoing.should include(c) end + it "#both returns an empty array for unconnected nodes" do + a = Neography::Node.create + a.both.size.should == 0 + end + it "#both(type) should return both incoming and outgoing nodes of the given type of depth one" do a,b,c,d,e,f = create_nodes