Skip to content

Commit

Permalink
create_relationship in batch can work without properties
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Oct 22, 2012
1 parent b8f5834 commit a4a3d31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/neography/rest/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def delete_relationship(id)
delete Relationships.base_path(:id => get_id(id))
end

def create_relationship(type, from, to, data)
def create_relationship(type, from, to, data = nil)
post build_node_uri(from) + "/relationships" do
{
:to => build_node_uri(to),
Expand Down
10 changes: 10 additions & 0 deletions spec/integration/rest_batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
batch_result.first["body"]["self"].should == new_relationship["self"]
end

it "can create a single relationship without properties" do
node1 = @neo.create_node
node2 = @neo.create_node
batch_result = @neo.batch [:create_relationship, "friends", node1, node2]
batch_result.first["body"]["type"].should == "friends"
batch_result.first["body"]["data"]["since"].should be_nil
batch_result.first["body"]["start"].split('/').last.should == node1["self"].split('/').last
batch_result.first["body"]["end"].split('/').last.should == node2["self"].split('/').last
end

it "can create a single relationship" do
node1 = @neo.create_node
node2 = @neo.create_node
Expand Down

0 comments on commit a4a3d31

Please sign in to comment.