From 8d1a37013ab75f9300ce8474471d9dbc2a203196 Mon Sep 17 00:00:00 2001 From: Max De Marzi Date: Wed, 30 Oct 2013 09:25:07 -0500 Subject: [PATCH] fixing issue 114 --- lib/neography/rest/paths.rb | 2 +- spec/integration/index_spec.rb | 8 ++++++++ spec/unit/rest/node_relationships_spec.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/neography/rest/paths.rb b/lib/neography/rest/paths.rb index 32a0e76..b322542 100644 --- a/lib/neography/rest/paths.rb +++ b/lib/neography/rest/paths.rb @@ -28,7 +28,7 @@ def build_path(path, attributes) end def encode(value) - URI.encode(value).gsub("/","%2F") + CGI.escape(value).gsub("+", "%20") end end diff --git a/spec/integration/index_spec.rb b/spec/integration/index_spec.rb index 7177e3a..7bdbbde 100644 --- a/spec/integration/index_spec.rb +++ b/spec/integration/index_spec.rb @@ -33,6 +33,14 @@ existing_node.name.should == value end + it "can find a node in an index with brackets" do + value = "Sen. Roy Blunt [R-MO]" + new_node = Neography::Node.create("name" => value) + new_node.add_to_index("node_test_index", "name", value) + existing_node = Neography::Node.find("node_test_index", "name", value) + existing_node.name.should == value + end + it "can find a relationship in an index" do value = generate_text node1 = Neography::Node.create diff --git a/spec/unit/rest/node_relationships_spec.rb b/spec/unit/rest/node_relationships_spec.rb index 4f47edd..06d8af4 100644 --- a/spec/unit/rest/node_relationships_spec.rb +++ b/spec/unit/rest/node_relationships_spec.rb @@ -39,7 +39,7 @@ class Rest end it "gets relationships with direction and types" do - connection.should_receive(:get).with("/node/42/relationships/in/foo&bar") + connection.should_receive(:get).with("/node/42/relationships/in/foo%26bar") subject.get("42", :in, ["foo", "bar"]) end