Skip to content

Commit

Permalink
adding test for batch get multiple node relationships, default to all…
Browse files Browse the repository at this point in the history
…, added to Contributors file, updated Neo4j to 1.7M02
  • Loading branch information
maxdemarzi committed Apr 2, 2012
1 parent 07495c5 commit 24a1c6c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ Contributors:
* Stephen Becker IV
* Thomas Baum
* Maximilian Schulz
* Hesham Amiri
* Hesham Amiri
* Pablo Fernandez
* Nick Reavill
* Marcel Sherf
2 changes: 1 addition & 1 deletion lib/neography/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def get_batch(args)
when :get_relationship_index
{:method => "GET", :to => "/index/relationship/#{args[1]}/#{args[2]}/#{args[3]}"}
when :get_node_relationships
{:method => "GET", :to => "/node/#{get_id(args[1])}/relationships/#{args[2]}"}
{:method => "GET", :to => "/node/#{get_id(args[1])}/relationships/#{args[2] || 'all'}"}
else
raise "Unknown option #{args[0]}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/neography/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace :neo4j do
desc "Install Neo4j"
task :install, :edition, :version do |t, args|
args.with_defaults(:edition => "community", :version => "1.7.M01")
args.with_defaults(:edition => "community", :version => "1.7.M02")
puts "Installing Neo4j-#{args[:edition]}-#{args[:version]}"

if OS::Underlying.windows?
Expand Down
18 changes: 18 additions & 0 deletions spec/integration/rest_batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,24 @@
[:add_relationship_to_index, "test_relationship_index", key, value, "{4}"]
batch_result.should_not be_nil
end

it "can get multiple relationships" do
node1 = @neo.create_node
node2 = @neo.create_node
node3 = @neo.create_node
new_relationship1 = @neo.create_relationship("friends", node1, node2)
new_relationship2 = @neo.create_relationship("brothers", node1, node3)
batch_result = @neo.batch [:get_node_relationships, node1]
batch_result.first["body"][0]["type"].should == "friends"
batch_result.first["body"][0]["start"].split('/').last.should == node1["self"].split('/').last
batch_result.first["body"][0]["end"].split('/').last.should == node2["self"].split('/').last
batch_result.first["body"][0]["self"].should == new_relationship1["self"]
batch_result.first["body"][1]["type"].should == "brothers"
batch_result.first["body"][1]["start"].split('/').last.should == node1["self"].split('/').last
batch_result.first["body"][1]["end"].split('/').last.should == node3["self"].split('/').last
batch_result.first["body"][1]["self"].should == new_relationship2["self"]
end

end

end

0 comments on commit 24a1c6c

Please sign in to comment.