neography 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +939 -0
  4. data/Guardfile +14 -0
  5. data/README.md +16 -14
  6. data/lib/neography/connection.rb +1 -0
  7. data/lib/neography/errors.rb +3 -0
  8. data/lib/neography/node.rb +21 -25
  9. data/lib/neography/property.rb +60 -11
  10. data/lib/neography/property_container.rb +5 -6
  11. data/lib/neography/rest/batch.rb +10 -0
  12. data/lib/neography/rest/node_properties.rb +1 -1
  13. data/lib/neography/version.rb +1 -1
  14. data/neography.gemspec +4 -2
  15. data/spec/integration/authorization_spec.rb +4 -4
  16. data/spec/integration/broken_spatial_spec.rb +6 -6
  17. data/spec/integration/index_spec.rb +6 -6
  18. data/spec/integration/neography_spec.rb +1 -1
  19. data/spec/integration/node_encoding_spec.rb +19 -19
  20. data/spec/integration/node_path_spec.rb +36 -36
  21. data/spec/integration/node_relationship_spec.rb +84 -84
  22. data/spec/integration/node_spec.rb +50 -50
  23. data/spec/integration/parsing_spec.rb +2 -2
  24. data/spec/integration/relationship_spec.rb +10 -10
  25. data/spec/integration/rest_batch_no_streaming_spec.rb +6 -6
  26. data/spec/integration/rest_batch_spec.rb +209 -188
  27. data/spec/integration/rest_batch_streaming_spec.rb +8 -8
  28. data/spec/integration/rest_bulk_spec.rb +23 -23
  29. data/spec/integration/rest_constraints_spec.rb +17 -17
  30. data/spec/integration/rest_experimental_spec.rb +2 -2
  31. data/spec/integration/rest_gremlin_fail_spec.rb +4 -4
  32. data/spec/integration/rest_header_spec.rb +3 -2
  33. data/spec/integration/rest_index_spec.rb +76 -76
  34. data/spec/integration/rest_labels_spec.rb +13 -13
  35. data/spec/integration/rest_node_spec.rb +50 -50
  36. data/spec/integration/rest_other_node_relationship_spec.rb +50 -50
  37. data/spec/integration/rest_path_spec.rb +55 -55
  38. data/spec/integration/rest_plugin_spec.rb +59 -59
  39. data/spec/integration/rest_relationship_spec.rb +77 -77
  40. data/spec/integration/rest_relationship_types_spec.rb +2 -2
  41. data/spec/integration/rest_schema_index_spec.rb +6 -6
  42. data/spec/integration/rest_spatial_spec.rb +50 -50
  43. data/spec/integration/rest_transaction_spec.rb +67 -67
  44. data/spec/integration/rest_traverse_spec.rb +40 -40
  45. data/spec/integration/unmanaged_spec.rb +3 -3
  46. data/spec/matchers.rb +2 -2
  47. data/spec/neography_spec.rb +3 -3
  48. data/spec/spec_helper.rb +2 -2
  49. data/spec/unit/config_spec.rb +95 -20
  50. data/spec/unit/connection_spec.rb +40 -40
  51. data/spec/unit/node_spec.rb +12 -12
  52. data/spec/unit/properties_spec.rb +174 -29
  53. data/spec/unit/relationship_spec.rb +16 -16
  54. data/spec/unit/rest/batch_spec.rb +23 -23
  55. data/spec/unit/rest/clean_spec.rb +1 -1
  56. data/spec/unit/rest/constraints_spec.rb +6 -6
  57. data/spec/unit/rest/cypher_spec.rb +1 -1
  58. data/spec/unit/rest/extensions_spec.rb +2 -2
  59. data/spec/unit/rest/gremlin_spec.rb +3 -3
  60. data/spec/unit/rest/helpers_spec.rb +19 -19
  61. data/spec/unit/rest/labels_spec.rb +10 -10
  62. data/spec/unit/rest/node_auto_indexes_spec.rb +13 -13
  63. data/spec/unit/rest/node_indexes_spec.rb +22 -22
  64. data/spec/unit/rest/node_paths_spec.rb +7 -7
  65. data/spec/unit/rest/node_properties_spec.rb +15 -15
  66. data/spec/unit/rest/node_relationships_spec.rb +10 -10
  67. data/spec/unit/rest/node_traversal_spec.rb +1 -1
  68. data/spec/unit/rest/nodes_spec.rb +32 -32
  69. data/spec/unit/rest/relationship_auto_indexes_spec.rb +12 -12
  70. data/spec/unit/rest/relationship_indexes_spec.rb +21 -21
  71. data/spec/unit/rest/relationship_properties_spec.rb +15 -15
  72. data/spec/unit/rest/relationship_types_spec.rb +1 -1
  73. data/spec/unit/rest/relationships_spec.rb +2 -2
  74. data/spec/unit/rest/schema_index_spec.rb +3 -3
  75. data/spec/unit/rest/transactions_spec.rb +4 -4
  76. metadata +32 -3
  77. data/ChangeLog +0 -658
@@ -11,9 +11,9 @@ describe Neography::Rest do
11
11
  new_node2 = @neo.create_node
12
12
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
13
13
  path = @neo.get_path(new_node1, new_node2, {"type"=> "friends", "direction" => "out"})
14
- path["start"].should == new_node1["self"]
15
- path["end"].should == new_node2["self"]
16
- path["nodes"].should == [new_node1["self"], new_node2["self"]]
14
+ expect(path["start"]).to eq(new_node1["self"])
15
+ expect(path["end"]).to eq(new_node2["self"])
16
+ expect(path["nodes"]).to eq([new_node1["self"], new_node2["self"]])
17
17
  end
18
18
 
19
19
  it "can get the shortest path between two nodes" do
@@ -28,9 +28,9 @@ describe Neography::Rest do
28
28
  @neo.create_relationship("friends", new_node4, new_node5)
29
29
  @neo.create_relationship("friends", new_node3, new_node5)
30
30
  path = @neo.get_path(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=3, algorithm="shortestPath")
31
- path["start"].should == new_node1["self"]
32
- path["end"].should == new_node5["self"]
33
- path["nodes"].should == [new_node1["self"], new_node2["self"], new_node3["self"], new_node5["self"]]
31
+ expect(path["start"]).to eq(new_node1["self"])
32
+ expect(path["end"]).to eq(new_node5["self"])
33
+ expect(path["nodes"]).to eq([new_node1["self"], new_node2["self"], new_node3["self"], new_node5["self"]])
34
34
  end
35
35
 
36
36
  it "can get the shortest weighted path between two nodes" do
@@ -50,9 +50,9 @@ describe Neography::Rest do
50
50
  @neo.set_relationship_properties(rel4_5, {:weight => 1})
51
51
  @neo.set_relationship_properties(rel3_5, {:weight => 3})
52
52
  path = @neo.get_shortest_weighted_path(new_node1, new_node5, {"type"=> "friends", "direction" => "out"})
53
- path.first["start"].should == new_node1["self"]
54
- path.first["end"].should == new_node5["self"]
55
- path.first["nodes"].should == [new_node1["self"], new_node2["self"], new_node3["self"], new_node4["self"], new_node5["self"]]
53
+ expect(path.first["start"]).to eq(new_node1["self"])
54
+ expect(path.first["end"]).to eq(new_node5["self"])
55
+ expect(path.first["nodes"]).to eq([new_node1["self"], new_node2["self"], new_node3["self"], new_node4["self"], new_node5["self"]])
56
56
  end
57
57
 
58
58
  it "can get a simple path between two nodes" do
@@ -67,9 +67,9 @@ describe Neography::Rest do
67
67
  @neo.create_relationship("friends", new_node4, new_node5)
68
68
  @neo.create_relationship("friends", new_node3, new_node5)
69
69
  path = @neo.get_path(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=3, algorithm="simplePaths")
70
- path["start"].should == new_node1["self"]
71
- path["end"].should == new_node5["self"]
72
- path["nodes"].should == [new_node1["self"], new_node2["self"], new_node3["self"], new_node5["self"]]
70
+ expect(path["start"]).to eq(new_node1["self"])
71
+ expect(path["end"]).to eq(new_node5["self"])
72
+ expect(path["nodes"]).to eq([new_node1["self"], new_node2["self"], new_node3["self"], new_node5["self"]])
73
73
  end
74
74
 
75
75
  it "fails to get a path between two nodes 3 nodes apart when using max depth of 2" do
@@ -101,9 +101,9 @@ describe Neography::Rest do
101
101
  @neo.create_relationship("friends", new_node3, new_node4)
102
102
  @neo.create_relationship("friends", new_node4, new_node5)
103
103
  path = @neo.get_path(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=4, algorithm="shortestPath")
104
- path["start"].should == new_node1["self"]
105
- path["end"].should == new_node5["self"]
106
- path["nodes"].should == [new_node1["self"], new_node2["self"], new_node3["self"], new_node4["self"], new_node5["self"]]
104
+ expect(path["start"]).to eq(new_node1["self"])
105
+ expect(path["end"]).to eq(new_node5["self"])
106
+ expect(path["nodes"]).to eq([new_node1["self"], new_node2["self"], new_node3["self"], new_node4["self"], new_node5["self"]])
107
107
  end
108
108
  end
109
109
 
@@ -121,13 +121,13 @@ describe Neography::Rest do
121
121
  @neo.create_relationship("friends", new_node4, new_node5)
122
122
  @neo.create_relationship("friends", new_node3, new_node5)
123
123
  paths = @neo.get_paths(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=4, algorithm="shortestPath")
124
- paths.length.should == 2
125
- paths[0]["length"].should == 2
126
- paths[0]["start"].should == new_node1["self"]
127
- paths[0]["end"].should == new_node5["self"]
128
- paths[1]["length"].should == 2
129
- paths[1]["start"].should == new_node1["self"]
130
- paths[1]["end"].should == new_node5["self"]
124
+ expect(paths.length).to eq(2)
125
+ expect(paths[0]["length"]).to eq(2)
126
+ expect(paths[0]["start"]).to eq(new_node1["self"])
127
+ expect(paths[0]["end"]).to eq(new_node5["self"])
128
+ expect(paths[1]["length"]).to eq(2)
129
+ expect(paths[1]["start"]).to eq(new_node1["self"])
130
+ expect(paths[1]["end"]).to eq(new_node5["self"])
131
131
  end
132
132
 
133
133
  it "can get all paths between two nodes" do
@@ -143,16 +143,16 @@ describe Neography::Rest do
143
143
  @neo.create_relationship("friends", new_node4, new_node5)
144
144
  @neo.create_relationship("friends", new_node3, new_node5)
145
145
  paths = @neo.get_paths(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=4, algorithm="allPaths")
146
- paths.length.should == 3
147
- paths[0]["length"].should == 2
148
- paths[0]["start"].should == new_node1["self"]
149
- paths[0]["end"].should == new_node5["self"]
150
- paths[1]["length"].should == 3
151
- paths[1]["start"].should == new_node1["self"]
152
- paths[1]["end"].should == new_node5["self"]
153
- paths[2]["length"].should == 2
154
- paths[2]["start"].should == new_node1["self"]
155
- paths[2]["end"].should == new_node5["self"]
146
+ expect(paths.length).to eq(3)
147
+ expect(paths[0]["length"]).to eq(2)
148
+ expect(paths[0]["start"]).to eq(new_node1["self"])
149
+ expect(paths[0]["end"]).to eq(new_node5["self"])
150
+ expect(paths[1]["length"]).to eq(3)
151
+ expect(paths[1]["start"]).to eq(new_node1["self"])
152
+ expect(paths[1]["end"]).to eq(new_node5["self"])
153
+ expect(paths[2]["length"]).to eq(2)
154
+ expect(paths[2]["start"]).to eq(new_node1["self"])
155
+ expect(paths[2]["end"]).to eq(new_node5["self"])
156
156
  end
157
157
 
158
158
  it "can get all simple paths between two nodes" do
@@ -169,16 +169,16 @@ describe Neography::Rest do
169
169
  @neo.create_relationship("friends", new_node4, new_node5)
170
170
  @neo.create_relationship("friends", new_node3, new_node5)
171
171
  paths = @neo.get_paths(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=4, algorithm="allSimplePaths")
172
- paths.length.should == 3
173
- paths[0]["length"].should == 2
174
- paths[0]["start"].should == new_node1["self"]
175
- paths[0]["end"].should == new_node5["self"]
176
- paths[1]["length"].should == 3
177
- paths[1]["start"].should == new_node1["self"]
178
- paths[1]["end"].should == new_node5["self"]
179
- paths[2]["length"].should == 2
180
- paths[2]["start"].should == new_node1["self"]
181
- paths[2]["end"].should == new_node5["self"]
172
+ expect(paths.length).to eq(3)
173
+ expect(paths[0]["length"]).to eq(2)
174
+ expect(paths[0]["start"]).to eq(new_node1["self"])
175
+ expect(paths[0]["end"]).to eq(new_node5["self"])
176
+ expect(paths[1]["length"]).to eq(3)
177
+ expect(paths[1]["start"]).to eq(new_node1["self"])
178
+ expect(paths[1]["end"]).to eq(new_node5["self"])
179
+ expect(paths[2]["length"]).to eq(2)
180
+ expect(paths[2]["start"]).to eq(new_node1["self"])
181
+ expect(paths[2]["end"]).to eq(new_node5["self"])
182
182
  end
183
183
 
184
184
  it "can get paths between two nodes of max depth 2" do
@@ -194,13 +194,13 @@ describe Neography::Rest do
194
194
  @neo.create_relationship("friends", new_node4, new_node5)
195
195
  @neo.create_relationship("friends", new_node3, new_node5)
196
196
  paths = @neo.get_paths(new_node1, new_node5, {"type"=> "friends", "direction" => "out"}, depth=2, algorithm="allPaths")
197
- paths.length.should == 2
198
- paths[0]["length"].should == 2
199
- paths[0]["start"].should == new_node1["self"]
200
- paths[0]["end"].should == new_node5["self"]
201
- paths[1]["length"].should == 2
202
- paths[1]["start"].should == new_node1["self"]
203
- paths[1]["end"].should == new_node5["self"] end
197
+ expect(paths.length).to eq(2)
198
+ expect(paths[0]["length"]).to eq(2)
199
+ expect(paths[0]["start"]).to eq(new_node1["self"])
200
+ expect(paths[0]["end"]).to eq(new_node5["self"])
201
+ expect(paths[1]["length"]).to eq(2)
202
+ expect(paths[1]["start"]).to eq(new_node1["self"])
203
+ expect(paths[1]["end"]).to eq(new_node5["self"]) end
204
204
 
205
205
  it "can get paths between two nodes of a specific relationship" do
206
206
  new_node1 = @neo.create_node
@@ -217,12 +217,12 @@ describe Neography::Rest do
217
217
  @neo.create_relationship("classmates", new_node1, new_node3)
218
218
  @neo.create_relationship("classmates", new_node3, new_node5)
219
219
  paths = @neo.get_paths(new_node1, new_node5, {"type"=> "classmates", "direction" => "out"}, depth=4, algorithm="allPaths")
220
- paths[0]["length"].should == 2
221
- paths[0]["start"].should == new_node1["self"]
222
- paths[0]["end"].should == new_node5["self"]
223
- paths[1]["length"].should == 2
224
- paths[1]["start"].should == new_node1["self"]
225
- paths[1]["end"].should == new_node5["self"]
220
+ expect(paths[0]["length"]).to eq(2)
221
+ expect(paths[0]["start"]).to eq(new_node1["self"])
222
+ expect(paths[0]["end"]).to eq(new_node5["self"])
223
+ expect(paths[1]["length"]).to eq(2)
224
+ expect(paths[1]["start"]).to eq(new_node1["self"])
225
+ expect(paths[1]["end"]).to eq(new_node5["self"])
226
226
  end
227
227
 
228
228
  end
@@ -10,47 +10,47 @@ describe Neography::Rest do
10
10
  describe "execute gremlin script" do
11
11
  it "can get the root node id", :gremlin => true do
12
12
  root_node = @neo.execute_script("g.v(0)")
13
- root_node.should have_key("self")
14
- root_node["self"].split('/').last.should == "0"
13
+ expect(root_node).to have_key("self")
14
+ expect(root_node["self"].split('/').last).to eq("0")
15
15
  end
16
16
 
17
17
  it "can get the a node", :gremlin => true do
18
18
  new_node = @neo.create_node
19
19
  id = new_node["self"].split('/').last
20
20
  existing_node = @neo.execute_script("g.v(#{id})")
21
- existing_node.should_not be_nil
22
- existing_node.should have_key("self")
23
- existing_node["self"].split('/').last.should == id
21
+ expect(existing_node).not_to be_nil
22
+ expect(existing_node).to have_key("self")
23
+ expect(existing_node["self"].split('/').last).to eq(id)
24
24
  end
25
25
 
26
26
  it "can get the a node with a variable", :gremlin => true do
27
27
  new_node = @neo.create_node
28
28
  id = new_node["self"].split('/').last
29
29
  existing_node = @neo.execute_script("g.v(id)", {:id => id.to_i})
30
- existing_node.should_not be_nil
31
- existing_node.should have_key("self")
32
- existing_node["self"].split('/').last.should == id
30
+ expect(existing_node).not_to be_nil
31
+ expect(existing_node).to have_key("self")
32
+ expect(existing_node["self"].split('/').last).to eq(id)
33
33
  end
34
34
  end
35
35
 
36
36
  describe "execute cypher query" do
37
37
  it "can get the root node id" do
38
38
  root_node = @neo.execute_query("start n=node(0) return n")
39
- root_node.should have_key("data")
40
- root_node.should have_key("columns")
41
- root_node["data"][0][0].should have_key("self")
42
- root_node["data"][0][0]["self"].split('/').last.should == "0"
39
+ expect(root_node).to have_key("data")
40
+ expect(root_node).to have_key("columns")
41
+ expect(root_node["data"][0][0]).to have_key("self")
42
+ expect(root_node["data"][0][0]["self"].split('/').last).to eq("0")
43
43
  end
44
44
 
45
45
  it "can get the a node" do
46
46
  new_node = @neo.create_node
47
47
  id = new_node["self"].split('/').last
48
48
  existing_node = @neo.execute_query("start n=node(#{id}) return n")
49
- existing_node.should_not be_nil
50
- existing_node.should have_key("data")
51
- existing_node.should have_key("columns")
52
- existing_node["data"][0][0].should have_key("self")
53
- existing_node["data"][0][0]["self"].split('/').last.should == id
49
+ expect(existing_node).not_to be_nil
50
+ expect(existing_node).to have_key("data")
51
+ expect(existing_node).to have_key("columns")
52
+ expect(existing_node["data"][0][0]).to have_key("self")
53
+ expect(existing_node["data"][0][0]["self"].split('/').last).to eq(id)
54
54
  end
55
55
 
56
56
  it "can perform a range query" do
@@ -60,14 +60,14 @@ describe Neography::Rest do
60
60
  @neo.create_node_index(name, "fulltext","lucene")
61
61
  @neo.add_node_to_index(name, "number", 3, new_node)
62
62
  existing_node = @neo.find_node_index(name, "number:[1 TO 5]")
63
- existing_node.first["self"].should == new_node["self"]
64
- existing_node.first.should_not be_nil
65
- existing_node.first["data"]["number"].should == 3
63
+ expect(existing_node.first["self"]).to eq(new_node["self"])
64
+ expect(existing_node.first).not_to be_nil
65
+ expect(existing_node.first["data"]["number"]).to eq(3)
66
66
  existing_node = @neo.execute_query("start n=node:#{name}(\"number:[1 TO 5]\") return n")
67
- existing_node.should have_key("data")
68
- existing_node.should have_key("columns")
69
- existing_node["data"][0][0].should have_key("self")
70
- existing_node["data"][0][0]["self"].split('/').last.should == id
67
+ expect(existing_node).to have_key("data")
68
+ expect(existing_node).to have_key("columns")
69
+ expect(existing_node["data"][0][0]).to have_key("self")
70
+ expect(existing_node["data"][0][0]["self"].split('/').last).to eq(id)
71
71
  end
72
72
 
73
73
  it "can perform a range query with a term" do
@@ -78,15 +78,15 @@ describe Neography::Rest do
78
78
  @neo.add_node_to_index(name, "number", 3, new_node)
79
79
  @neo.add_node_to_index(name, "name", "max", new_node)
80
80
  existing_node = @neo.find_node_index(name, "name:max AND number:[1 TO 5]")
81
- existing_node.first["self"].should == new_node["self"]
82
- existing_node.first.should_not be_nil
83
- existing_node.first["data"]["number"].should == 3
84
- existing_node.first["data"]["name"].should == "Max"
81
+ expect(existing_node.first["self"]).to eq(new_node["self"])
82
+ expect(existing_node.first).not_to be_nil
83
+ expect(existing_node.first["data"]["number"]).to eq(3)
84
+ expect(existing_node.first["data"]["name"]).to eq("Max")
85
85
  existing_node = @neo.execute_query("start n=node:#{name}(\"name:max AND number:[1 TO 5]\") return n")
86
- existing_node.should have_key("data")
87
- existing_node.should have_key("columns")
88
- existing_node["data"][0][0].should have_key("self")
89
- existing_node["data"][0][0]["self"].split('/').last.should == id
86
+ expect(existing_node).to have_key("data")
87
+ expect(existing_node).to have_key("columns")
88
+ expect(existing_node["data"][0][0]).to have_key("self")
89
+ expect(existing_node["data"][0][0]["self"].split('/').last).to eq(id)
90
90
  end
91
91
 
92
92
 
@@ -94,50 +94,50 @@ describe Neography::Rest do
94
94
  new_node = @neo.create_node("name" => "Ateísmo Sureño")
95
95
  id = new_node["self"].split('/').last
96
96
  existing_node = @neo.execute_query("start n=node(#{id}) return n")
97
- existing_node.should_not be_nil
98
- existing_node.should have_key("data")
99
- existing_node.should have_key("columns")
100
- existing_node["data"][0][0]["self"].split('/').last.should == id
101
- existing_node["data"][0][0]["data"]["name"].should == "Ateísmo Sureño"
97
+ expect(existing_node).not_to be_nil
98
+ expect(existing_node).to have_key("data")
99
+ expect(existing_node).to have_key("columns")
100
+ expect(existing_node["data"][0][0]["self"].split('/').last).to eq(id)
101
+ expect(existing_node["data"][0][0]["data"]["name"]).to eq("Ateísmo Sureño")
102
102
  end
103
103
 
104
104
  it "can get the a node with a variable" do
105
105
  new_node = @neo.create_node
106
106
  id = new_node["self"].split('/').last
107
107
  existing_node = @neo.execute_query("start n=node({id}) return n", {:id => id.to_i})
108
- existing_node.should_not be_nil
109
- existing_node.should have_key("data")
110
- existing_node.should have_key("columns")
111
- existing_node["data"][0][0].should have_key("self")
112
- existing_node["data"][0][0]["self"].split('/').last.should == id
108
+ expect(existing_node).not_to be_nil
109
+ expect(existing_node).to have_key("data")
110
+ expect(existing_node).to have_key("columns")
111
+ expect(existing_node["data"][0][0]).to have_key("self")
112
+ expect(existing_node["data"][0][0]["self"].split('/').last).to eq(id)
113
113
  end
114
114
 
115
115
  it "can get the stats of a cypher query" do
116
116
  root_node = @neo.execute_query("start n=node(0) return n", nil, {:stats => true})
117
- root_node.should have_key("data")
118
- root_node.should have_key("columns")
119
- root_node.should have_key("stats")
120
- root_node["data"][0][0].should have_key("self")
121
- root_node["data"][0][0]["self"].split('/').last.should == "0"
117
+ expect(root_node).to have_key("data")
118
+ expect(root_node).to have_key("columns")
119
+ expect(root_node).to have_key("stats")
120
+ expect(root_node["data"][0][0]).to have_key("self")
121
+ expect(root_node["data"][0][0]["self"].split('/').last).to eq("0")
122
122
  end
123
123
 
124
124
  it "can get the profile of a cypher query" do
125
125
  root_node = @neo.execute_query("start n=node(0) return n", nil, {:profile => true})
126
- root_node.should have_key("data")
127
- root_node.should have_key("columns")
128
- root_node.should have_key("plan")
129
- root_node["data"][0][0].should have_key("self")
130
- root_node["data"][0][0]["self"].split('/').last.should == "0"
126
+ expect(root_node).to have_key("data")
127
+ expect(root_node).to have_key("columns")
128
+ expect(root_node).to have_key("plan")
129
+ expect(root_node["data"][0][0]).to have_key("self")
130
+ expect(root_node["data"][0][0]["self"].split('/').last).to eq("0")
131
131
  end
132
132
 
133
133
  it "can get the stats and profile of a cypher query" do
134
134
  root_node = @neo.execute_query("start n=node(0) return n", nil, {:stats => true, :profile => true})
135
- root_node.should have_key("data")
136
- root_node.should have_key("columns")
137
- root_node.should have_key("stats")
138
- root_node.should have_key("plan")
139
- root_node["data"][0][0].should have_key("self")
140
- root_node["data"][0][0]["self"].split('/').last.should == "0"
135
+ expect(root_node).to have_key("data")
136
+ expect(root_node).to have_key("columns")
137
+ expect(root_node).to have_key("stats")
138
+ expect(root_node).to have_key("plan")
139
+ expect(root_node["data"][0][0]).to have_key("self")
140
+ expect(root_node["data"][0][0]["self"].split('/').last).to eq("0")
141
141
  end
142
142
 
143
143
 
@@ -147,7 +147,7 @@ describe Neography::Rest do
147
147
  @neo.execute_query("start n=node({id}) return n", {:id => 1})
148
148
  }.to raise_error(Neography::BadInputException)
149
149
  root_node = @neo.execute_query("start n=node({id}) return n", {:id => 0})
150
- root_node.should_not be_nil
150
+ expect(root_node).not_to be_nil
151
151
  end
152
152
 
153
153
  it "throws an error for an invalid query" do
@@ -10,8 +10,8 @@ describe Neography::Rest do
10
10
  new_node1 = @neo.create_node
11
11
  new_node2 = @neo.create_node
12
12
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2)
13
- new_relationship["start"].should_not be_nil
14
- new_relationship["end"].should_not be_nil
13
+ expect(new_relationship["start"]).not_to be_nil
14
+ expect(new_relationship["end"]).not_to be_nil
15
15
  end
16
16
 
17
17
  it "can create a relationship with one property" do
@@ -20,15 +20,15 @@ describe Neography::Rest do
20
20
  new_node2 = @neo.create_node
21
21
  new_node2[:id] = new_node2["self"].split('/').last
22
22
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010'})
23
- new_relationship["data"]["since"].should == '10-1-2010'
23
+ expect(new_relationship["data"]["since"]).to eq('10-1-2010')
24
24
  end
25
25
 
26
26
  it "can create a relationship with more than one property" do
27
27
  new_node1 = @neo.create_node
28
28
  new_node2 = @neo.create_node
29
29
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
30
- new_relationship["data"]["since"].should == '10-1-2010'
31
- new_relationship["data"]["met"].should == "college"
30
+ expect(new_relationship["data"]["since"]).to eq('10-1-2010')
31
+ expect(new_relationship["data"]["met"]).to eq("college")
32
32
  end
33
33
 
34
34
  it "can create a unique node with more than one property" do
@@ -37,8 +37,8 @@ describe Neography::Rest do
37
37
  value = generate_text
38
38
  @neo.create_node_index(index_name)
39
39
  new_node = @neo.create_unique_node(index_name, key, value, {"age" => 31, "name" => "Max"})
40
- new_node["data"]["name"].should == "Max"
41
- new_node["data"]["age"].should == 31
40
+ expect(new_node["data"]["name"]).to eq("Max")
41
+ expect(new_node["data"]["age"]).to eq(31)
42
42
  end
43
43
 
44
44
  it "can create a unique relationship" do
@@ -48,7 +48,7 @@ describe Neography::Rest do
48
48
  new_node1 = @neo.create_node
49
49
  new_node2 = @neo.create_node
50
50
  new_relationship = @neo.create_unique_relationship(index_name, key, value, "friends", new_node1, new_node2)
51
- new_relationship["data"][key].should == value
51
+ expect(new_relationship["data"][key]).to eq(value)
52
52
  end
53
53
 
54
54
  end
@@ -59,9 +59,9 @@ describe Neography::Rest do
59
59
  new_node2 = @neo.create_node
60
60
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2)
61
61
  existing_relationship = @neo.get_relationship(new_relationship)
62
- existing_relationship.should_not be_nil
63
- existing_relationship.should have_key("self")
64
- existing_relationship["self"].should == new_relationship["self"]
62
+ expect(existing_relationship).not_to be_nil
63
+ expect(existing_relationship).to have_key("self")
64
+ expect(existing_relationship["self"]).to eq(new_relationship["self"])
65
65
  end
66
66
 
67
67
  it "raises error if it tries to get a relationship that does not exist" do
@@ -83,9 +83,9 @@ describe Neography::Rest do
83
83
  @neo.set_relationship_properties(new_relationship, {"since" => '10-1-2010', "met" => "college"})
84
84
  @neo.set_relationship_properties(new_relationship, {"roommates" => "no"})
85
85
  relationship_properties = @neo.get_relationship_properties(new_relationship)
86
- relationship_properties["since"].should == '10-1-2010'
87
- relationship_properties["met"].should == "college"
88
- relationship_properties["roommates"].should == "no"
86
+ expect(relationship_properties["since"]).to eq('10-1-2010')
87
+ expect(relationship_properties["met"]).to eq("college")
88
+ expect(relationship_properties["roommates"]).to eq("no")
89
89
  end
90
90
 
91
91
  it "it fails to set properties on a relationship that does not exist" do
@@ -107,9 +107,9 @@ describe Neography::Rest do
107
107
  @neo.set_relationship_properties(new_relationship, {"since" => '10-1-2010', "met" => "college"})
108
108
  @neo.reset_relationship_properties(new_relationship, {"roommates" => "no"})
109
109
  relationship_properties = @neo.get_relationship_properties(new_relationship)
110
- relationship_properties["since"].should be_nil
111
- relationship_properties["met"].should be_nil
112
- relationship_properties["roommates"].should == "no"
110
+ expect(relationship_properties["since"]).to be_nil
111
+ expect(relationship_properties["met"]).to be_nil
112
+ expect(relationship_properties["roommates"]).to eq("no")
113
113
  end
114
114
 
115
115
  it "it fails to reset properties on a relationship that does not exist" do
@@ -129,8 +129,8 @@ describe Neography::Rest do
129
129
  new_node2 = @neo.create_node
130
130
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
131
131
  relationship_properties = @neo.get_relationship_properties(new_relationship)
132
- relationship_properties["since"].should == '10-1-2010'
133
- relationship_properties["met"].should == "college"
132
+ expect(relationship_properties["since"]).to eq('10-1-2010')
133
+ expect(relationship_properties["met"]).to eq("college")
134
134
  end
135
135
 
136
136
  it "can get some of a relationship's properties" do
@@ -138,9 +138,9 @@ describe Neography::Rest do
138
138
  new_node2 = @neo.create_node
139
139
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college", "roommates" => "no"})
140
140
  relationship_properties = @neo.get_relationship_properties(new_relationship, ["since", "roommates"])
141
- relationship_properties["since"].should == '10-1-2010'
142
- relationship_properties["met"].should be_nil
143
- relationship_properties["roommates"].should == "no"
141
+ expect(relationship_properties["since"]).to eq('10-1-2010')
142
+ expect(relationship_properties["met"]).to be_nil
143
+ expect(relationship_properties["roommates"]).to eq("no")
144
144
  end
145
145
 
146
146
  it "returns nil if it gets the properties on a relationship that does not have any" do
@@ -148,7 +148,7 @@ describe Neography::Rest do
148
148
  new_node2 = @neo.create_node
149
149
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2)
150
150
  relationship_properties = @neo.get_relationship_properties(new_relationship)
151
- relationship_properties.should be_nil
151
+ expect(relationship_properties).to be_nil
152
152
  end
153
153
 
154
154
  it "raises error if it tries to get some of the properties on a relationship that does not have any" do
@@ -177,7 +177,7 @@ describe Neography::Rest do
177
177
  new_node2 = @neo.create_node
178
178
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
179
179
  @neo.remove_relationship_properties(new_relationship)
180
- @neo.get_relationship_properties(new_relationship).should be_nil
180
+ expect(@neo.get_relationship_properties(new_relationship)).to be_nil
181
181
  end
182
182
 
183
183
  it "raises error if it fails to remove the properties of a relationship that does not exist" do
@@ -196,8 +196,8 @@ describe Neography::Rest do
196
196
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
197
197
  @neo.remove_relationship_properties(new_relationship, "met")
198
198
  relationship_properties = @neo.get_relationship_properties(new_relationship)
199
- relationship_properties["met"].should be_nil
200
- relationship_properties["since"].should == '10-1-2010'
199
+ expect(relationship_properties["met"]).to be_nil
200
+ expect(relationship_properties["since"]).to eq('10-1-2010')
201
201
  end
202
202
 
203
203
  it "can remove more than one relationship property" do
@@ -206,9 +206,9 @@ describe Neography::Rest do
206
206
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college", "roommates" => "no"})
207
207
  @neo.remove_relationship_properties(new_relationship, ["met", "since"])
208
208
  relationship_properties = @neo.get_relationship_properties(new_relationship)
209
- relationship_properties["met"].should be_nil
210
- relationship_properties["since"].should be_nil
211
- relationship_properties["roommates"].should == "no"
209
+ expect(relationship_properties["met"]).to be_nil
210
+ expect(relationship_properties["since"]).to be_nil
211
+ expect(relationship_properties["roommates"]).to eq("no")
212
212
  end
213
213
  end
214
214
 
@@ -219,7 +219,7 @@ describe Neography::Rest do
219
219
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
220
220
  @neo.delete_relationship(new_relationship)
221
221
  relationships = @neo.get_node_relationships(new_node1)
222
- relationships.should be_empty
222
+ expect(relationships).to be_empty
223
223
  end
224
224
 
225
225
  it "raises error if it tries to delete a relationship that does not exist" do
@@ -237,7 +237,7 @@ describe Neography::Rest do
237
237
  new_node2 = @neo.create_node
238
238
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
239
239
  existing_relationship = @neo.delete_relationship(new_relationship)
240
- existing_relationship.should be_nil
240
+ expect(existing_relationship).to be_nil
241
241
  expect {
242
242
  existing_relationship = @neo.delete_relationship(new_relationship)
243
243
  }.to raise_error Neography::RelationshipNotFoundException
@@ -250,12 +250,12 @@ describe Neography::Rest do
250
250
  new_node2 = @neo.create_node
251
251
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
252
252
  relationships = @neo.get_node_relationships(new_node1)
253
- relationships.should_not be_nil
254
- relationships[0]["start"].should == new_node1["self"]
255
- relationships[0]["end"].should == new_node2["self"]
256
- relationships[0]["type"].should == "friends"
257
- relationships[0]["data"]["met"].should == "college"
258
- relationships[0]["data"]["since"].should == '10-1-2005'
253
+ expect(relationships).not_to be_nil
254
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
255
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
256
+ expect(relationships[0]["type"]).to eq("friends")
257
+ expect(relationships[0]["data"]["met"]).to eq("college")
258
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
259
259
  end
260
260
 
261
261
  it "can get a node's multiple relationships" do
@@ -265,17 +265,17 @@ describe Neography::Rest do
265
265
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
266
266
  new_relationship = @neo.create_relationship("enemies", new_node1, new_node3, {"since" => '10-2-2010', "met" => "work"})
267
267
  relationships = @neo.get_node_relationships(new_node1)
268
- relationships.should_not be_nil
269
- relationships[0]["start"].should == new_node1["self"]
270
- relationships[0]["end"].should == new_node2["self"]
271
- relationships[0]["type"].should == "friends"
272
- relationships[0]["data"]["met"].should == "college"
273
- relationships[0]["data"]["since"].should == '10-1-2005'
274
- relationships[1]["start"].should == new_node1["self"]
275
- relationships[1]["end"].should == new_node3["self"]
276
- relationships[1]["type"].should == "enemies"
277
- relationships[1]["data"]["met"].should == "work"
278
- relationships[1]["data"]["since"].should == '10-2-2010'
268
+ expect(relationships).not_to be_nil
269
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
270
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
271
+ expect(relationships[0]["type"]).to eq("friends")
272
+ expect(relationships[0]["data"]["met"]).to eq("college")
273
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
274
+ expect(relationships[1]["start"]).to eq(new_node1["self"])
275
+ expect(relationships[1]["end"]).to eq(new_node3["self"])
276
+ expect(relationships[1]["type"]).to eq("enemies")
277
+ expect(relationships[1]["data"]["met"]).to eq("work")
278
+ expect(relationships[1]["data"]["since"]).to eq('10-2-2010')
279
279
  end
280
280
 
281
281
  it "can get a node's outgoing relationship" do
@@ -285,13 +285,13 @@ describe Neography::Rest do
285
285
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
286
286
  new_relationship = @neo.create_relationship("enemies", new_node3, new_node1, {"since" => '10-2-2010', "met" => "work"})
287
287
  relationships = @neo.get_node_relationships(new_node1, "out")
288
- relationships.should_not be_nil
289
- relationships[0]["start"].should == new_node1["self"]
290
- relationships[0]["end"].should == new_node2["self"]
291
- relationships[0]["type"].should == "friends"
292
- relationships[0]["data"]["met"].should == "college"
293
- relationships[0]["data"]["since"].should == '10-1-2005'
294
- relationships[1].should be_nil
288
+ expect(relationships).not_to be_nil
289
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
290
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
291
+ expect(relationships[0]["type"]).to eq("friends")
292
+ expect(relationships[0]["data"]["met"]).to eq("college")
293
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
294
+ expect(relationships[1]).to be_nil
295
295
  end
296
296
 
297
297
  it "can get a node's incoming relationship" do
@@ -301,13 +301,13 @@ describe Neography::Rest do
301
301
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
302
302
  new_relationship = @neo.create_relationship("enemies", new_node3, new_node1, {"since" => '10-2-2010', "met" => "work"})
303
303
  relationships = @neo.get_node_relationships(new_node1, "in")
304
- relationships.should_not be_nil
305
- relationships[0]["start"].should == new_node3["self"]
306
- relationships[0]["end"].should == new_node1["self"]
307
- relationships[0]["type"].should == "enemies"
308
- relationships[0]["data"]["met"].should == "work"
309
- relationships[0]["data"]["since"].should == '10-2-2010'
310
- relationships[1].should be_nil
304
+ expect(relationships).not_to be_nil
305
+ expect(relationships[0]["start"]).to eq(new_node3["self"])
306
+ expect(relationships[0]["end"]).to eq(new_node1["self"])
307
+ expect(relationships[0]["type"]).to eq("enemies")
308
+ expect(relationships[0]["data"]["met"]).to eq("work")
309
+ expect(relationships[0]["data"]["since"]).to eq('10-2-2010')
310
+ expect(relationships[1]).to be_nil
311
311
  end
312
312
 
313
313
  it "can get a specific type of node relationships" do
@@ -317,13 +317,13 @@ describe Neography::Rest do
317
317
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
318
318
  new_relationship = @neo.create_relationship("enemies", new_node1, new_node3, {"since" => '10-2-2010', "met" => "work"})
319
319
  relationships = @neo.get_node_relationships(new_node1, "all", "friends")
320
- relationships.should_not be_nil
321
- relationships[0]["start"].should == new_node1["self"]
322
- relationships[0]["end"].should == new_node2["self"]
323
- relationships[0]["type"].should == "friends"
324
- relationships[0]["data"]["met"].should == "college"
325
- relationships[0]["data"]["since"].should == '10-1-2005'
326
- relationships[1].should be_nil
320
+ expect(relationships).not_to be_nil
321
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
322
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
323
+ expect(relationships[0]["type"]).to eq("friends")
324
+ expect(relationships[0]["data"]["met"]).to eq("college")
325
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
326
+ expect(relationships[1]).to be_nil
327
327
  end
328
328
 
329
329
  it "can get a specific type and direction of a node relationships" do
@@ -335,19 +335,19 @@ describe Neography::Rest do
335
335
  new_relationship = @neo.create_relationship("enemies", new_node1, new_node3, {"since" => '10-2-2010', "met" => "work"})
336
336
  new_relationship = @neo.create_relationship("enemies", new_node4, new_node1, {"since" => '10-3-2010', "met" => "gym"})
337
337
  relationships = @neo.get_node_relationships(new_node1, "in", "enemies")
338
- relationships.should_not be_nil
339
- relationships[0]["start"].should == new_node4["self"]
340
- relationships[0]["end"].should == new_node1["self"]
341
- relationships[0]["type"].should == "enemies"
342
- relationships[0]["data"]["met"].should == "gym"
343
- relationships[0]["data"]["since"].should == '10-3-2010'
344
- relationships[1].should be_nil
338
+ expect(relationships).not_to be_nil
339
+ expect(relationships[0]["start"]).to eq(new_node4["self"])
340
+ expect(relationships[0]["end"]).to eq(new_node1["self"])
341
+ expect(relationships[0]["type"]).to eq("enemies")
342
+ expect(relationships[0]["data"]["met"]).to eq("gym")
343
+ expect(relationships[0]["data"]["since"]).to eq('10-3-2010')
344
+ expect(relationships[1]).to be_nil
345
345
  end
346
346
 
347
347
  it "returns nil if there are no relationships" do
348
348
  new_node1 = @neo.create_node
349
349
  relationships = @neo.get_node_relationships(new_node1)
350
- relationships.should be_empty
350
+ expect(relationships).to be_empty
351
351
  end
352
352
  end
353
353