Skip to content

Commit

Permalink
Fix bug: Relationship.load(nil) == Relationship.load(0) [#167 state:r…
Browse files Browse the repository at this point in the history
…esolved]
  • Loading branch information
andreasronge committed May 13, 2011
1 parent a89a35e commit c1662bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/neo4j/relationship.rb
Expand Up @@ -165,6 +165,7 @@ def load(rel_id, db = Neo4j.started_db)
# Same as load but does not return the node as a wrapped Ruby object.
#
def _load(rel_id, db = Neo4j.started_db)
return nil if rel_id.nil?
rel = db.graph.get_relationship_by_id(rel_id.to_i)
rel.hasProperty('_classname') # since we want a IllegalStateException which is otherwise not triggered
rel
Expand Down
5 changes: 5 additions & 0 deletions spec/relationship_spec.rb
Expand Up @@ -2,6 +2,11 @@


describe Neo4j::Relationship, :type=> :transactional do

it "#load(nil) return nil" do
Neo4j::Relationship.load(nil).should be_nil
end

it "#end_node, #start_node and #other_node should return Ruby wrapped object" do
p1 = SimpleNode.new
p2 = SimpleNode.new
Expand Down

0 comments on commit c1662bd

Please sign in to comment.