From dc99e62065cb2cb9f29d85bb1e2c475a64bd64de Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 1 Feb 2013 12:26:46 -0700 Subject: [PATCH] Fixed error test Needed to specify which error in the spec. Fixed code so it works properly with the correct error now --- lib/neography/connection.rb | 10 +++++----- spec/integration/rest_index_spec.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/neography/connection.rb b/lib/neography/connection.rb index 710e5eb..088ea94 100644 --- a/lib/neography/connection.rb +++ b/lib/neography/connection.rb @@ -105,14 +105,14 @@ def evaluate_response(response) end def handle_4xx_500_response(code, body) - if body - parsed_body = JSON.parse(body) - message = parsed_body["message"] - stacktrace = parsed_body["stacktrace"] - else + if body.nil? or body == "" parsed_body = {} message = "No error message returned from server." stacktrace = "" + else + parsed_body = JSON.parse(body) + message = parsed_body["message"] + stacktrace = parsed_body["stacktrace"] end @logger.error "#{code} error: #{body}" if @log_enabled diff --git a/spec/integration/rest_index_spec.rb b/spec/integration/rest_index_spec.rb index 956b59a..6e70797 100644 --- a/spec/integration/rest_index_spec.rb +++ b/spec/integration/rest_index_spec.rb @@ -175,7 +175,7 @@ @neo.add_node_to_index("test_node_index", key, value, new_node) new_index = @neo.get_node_index("test_node_index", key, value) new_index.should_not be_nil - expect { @neo.remove_node_from_index("test_node_index", key, "", new_node) }.to raise_error + expect { @neo.remove_node_from_index("test_node_index", key, "", new_node) }.to raise_error Neography::NeographyError end end