From 7b87efb5b852c8cad9eff137300c9eb738328878 Mon Sep 17 00:00:00 2001 From: David Raphael Date: Fri, 12 Apr 2013 10:38:04 -0500 Subject: [PATCH 1/2] Created failing example for batch queries --- spec/integration/rest_batch_spec.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/spec/integration/rest_batch_spec.rb b/spec/integration/rest_batch_spec.rb index 418d479..b71851c 100644 --- a/spec/integration/rest_batch_spec.rb +++ b/spec/integration/rest_batch_spec.rb @@ -452,5 +452,26 @@ end end - + + describe "broken queries" do + it "should return errors when bad syntax is passed in batch" do + + batch_commands = [] + batch_commands << [ :create_unique_node, "person", "ssn", "000-00-0001", {:foo => "bar"} ] + + # this doesn't raise error + batch_commands << [ :execute_query, "start person_n=node:person(ssn = '000-00-0001') + set bar = {foo}", + { :other => "what" } + ] + + # this does raise error + @neo.execute_query("start person_n=node:person(ssn = '000-00-0001') + set bar = {foo}", + { :other => "what" }) + + batch_result = @neo.batch *batch_commands + end + end + end From a2cdf54af2167ab0dcddec431c4176a6fbbde6c3 Mon Sep 17 00:00:00 2001 From: David Raphael Date: Fri, 12 Apr 2013 10:41:08 -0500 Subject: [PATCH 2/2] added additional expect for exception --- spec/integration/rest_batch_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/integration/rest_batch_spec.rb b/spec/integration/rest_batch_spec.rb index b71851c..907a3bd 100644 --- a/spec/integration/rest_batch_spec.rb +++ b/spec/integration/rest_batch_spec.rb @@ -466,9 +466,11 @@ ] # this does raise error - @neo.execute_query("start person_n=node:person(ssn = '000-00-0001') - set bar = {foo}", - { :other => "what" }) + expect { + @neo.execute_query("start person_n=node:person(ssn = '000-00-0001') + set bar = {foo}", + { :other => "what" }) + }.to raise_exception Neography::SyntaxException batch_result = @neo.batch *batch_commands end