neography 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -9,7 +9,7 @@ describe Neography::Rest do
9
9
  it "can get the labels of the database" do
10
10
  @neo.set_label(0, "Person")
11
11
  labels = @neo.list_labels
12
- labels.should include("Person")
12
+ expect(labels).to include("Person")
13
13
  end
14
14
  end
15
15
 
@@ -18,7 +18,7 @@ describe Neography::Rest do
18
18
  new_node = @neo.create_node
19
19
  @neo.add_label(new_node, "Person")
20
20
  labels = @neo.get_node_labels(new_node)
21
- labels.should == ["Person"]
21
+ expect(labels).to eq(["Person"])
22
22
  end
23
23
 
24
24
  it "can add another label to a node" do
@@ -27,7 +27,7 @@ describe Neography::Rest do
27
27
  @neo.add_label(new_node_id, "Actor")
28
28
  @neo.add_label(new_node_id, "Director")
29
29
  labels = @neo.get_node_labels(new_node_id)
30
- labels.should == ["Actor", "Director"]
30
+ expect(labels).to eq(["Actor", "Director"])
31
31
  end
32
32
 
33
33
  it "can add multiple labels to a node" do
@@ -35,7 +35,7 @@ describe Neography::Rest do
35
35
  new_node_id = new_node["self"].split('/').last
36
36
  @neo.add_label(new_node_id, ["Actor", "Director"])
37
37
  labels = @neo.get_node_labels(new_node_id)
38
- labels.should == ["Actor", "Director"]
38
+ expect(labels).to eq(["Actor", "Director"])
39
39
  end
40
40
  end
41
41
 
@@ -45,7 +45,7 @@ describe Neography::Rest do
45
45
  new_node_id = new_node["self"].split('/').last
46
46
  @neo.set_label(new_node_id, "Person")
47
47
  labels = @neo.get_node_labels(new_node_id)
48
- labels.should == ["Person"]
48
+ expect(labels).to eq(["Person"])
49
49
  end
50
50
 
51
51
  it "can set a label to a node that already had a label" do
@@ -53,7 +53,7 @@ describe Neography::Rest do
53
53
  @neo.add_label(new_node, "Actor")
54
54
  @neo.set_label(new_node, "Director")
55
55
  labels = @neo.get_node_labels(new_node)
56
- labels.should == ["Director"]
56
+ expect(labels).to eq(["Director"])
57
57
  end
58
58
 
59
59
  it "can set multiple labels to a node" do
@@ -61,7 +61,7 @@ describe Neography::Rest do
61
61
  new_node_id = new_node["self"].split('/').last
62
62
  @neo.set_label(new_node_id, ["Actor", "Director"])
63
63
  labels = @neo.get_node_labels(new_node_id)
64
- labels.should == ["Actor", "Director"]
64
+ expect(labels).to eq(["Actor", "Director"])
65
65
  end
66
66
  end
67
67
 
@@ -71,7 +71,7 @@ describe Neography::Rest do
71
71
  @neo.set_label(new_node, ["Actor", "Director"])
72
72
  @neo.delete_label(new_node, "Actor")
73
73
  labels = @neo.get_node_labels(new_node)
74
- labels.should == ["Director"]
74
+ expect(labels).to eq(["Director"])
75
75
  end
76
76
 
77
77
  it "can delete a label from a node that doesn't have one" do
@@ -79,7 +79,7 @@ describe Neography::Rest do
79
79
  new_node_id = new_node["self"].split('/').last
80
80
  @neo.delete_label(new_node_id, "Actor")
81
81
  labels = @neo.get_node_labels(new_node_id)
82
- labels.should == []
82
+ expect(labels).to eq([])
83
83
  end
84
84
 
85
85
  it "cannot delete a label from a node that doesn't exist" do
@@ -97,12 +97,12 @@ describe Neography::Rest do
97
97
  new_node_id = new_node["self"].split('/').last
98
98
  @neo.set_label(new_node_id, ["Actor", "Director"])
99
99
  nodes = @neo.get_nodes_labeled("Actor")
100
- nodes.last["self"].split('/').last.should == new_node_id
100
+ expect(nodes.last["self"].split('/').last).to eq(new_node_id)
101
101
  end
102
102
 
103
103
  it "returns an empty array on non-existing label" do
104
104
  nodes = @neo.get_nodes_labeled("do_not_exist")
105
- nodes.should == []
105
+ expect(nodes).to eq([])
106
106
  end
107
107
  end
108
108
 
@@ -112,7 +112,7 @@ describe Neography::Rest do
112
112
  new_node_id = new_node["self"].split('/').last
113
113
  @neo.set_label(new_node_id, "clown")
114
114
  nodes = @neo.find_nodes_labeled("clown", { :name => "max" })
115
- nodes.last["self"].split('/').last.should == new_node_id
115
+ expect(nodes.last["self"].split('/').last).to eq(new_node_id)
116
116
  end
117
117
 
118
118
  it "returns an empty array on non-existing label property" do
@@ -120,7 +120,7 @@ describe Neography::Rest do
120
120
  new_node_id = new_node["self"].split('/').last
121
121
  @neo.set_label(new_node_id, "clown")
122
122
  nodes = @neo.find_nodes_labeled("clown", { :name => "does_not_exist" })
123
- nodes.should == []
123
+ expect(nodes).to eq([])
124
124
  end
125
125
 
126
126
  end
@@ -10,33 +10,33 @@ describe Neography::Rest do
10
10
  describe "get_root" do
11
11
  it "can get the root node", :reference => true do
12
12
  root_node = @neo.get_root
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
  end
17
17
 
18
18
  describe "create_node" do
19
19
  it "can create an empty node" do
20
20
  new_node = @neo.create_node
21
- new_node.should_not be_nil
21
+ expect(new_node).not_to be_nil
22
22
  end
23
23
 
24
24
  it "can create a node with one property" do
25
25
  new_node = @neo.create_node("name" => "Max")
26
- new_node["data"]["name"].should == "Max"
26
+ expect(new_node["data"]["name"]).to eq("Max")
27
27
  end
28
28
 
29
29
  it "can create a node with nil properties" do
30
30
  new_node = @neo.create_node("name" => "Max", "age" => nil )
31
- new_node["data"]["name"].should == "Max"
32
- new_node["data"]["age"].should be_nil
31
+ expect(new_node["data"]["name"]).to eq("Max")
32
+ expect(new_node["data"]["age"]).to be_nil
33
33
  end
34
34
 
35
35
 
36
36
  it "can create a node with more than one property" do
37
37
  new_node = @neo.create_node("age" => 31, "name" => "Max")
38
- new_node["data"]["name"].should == "Max"
39
- new_node["data"]["age"].should == 31
38
+ expect(new_node["data"]["name"]).to eq("Max")
39
+ expect(new_node["data"]["age"]).to eq(31)
40
40
  end
41
41
 
42
42
  it "can create a unique node with more than one property" do
@@ -45,13 +45,13 @@ describe Neography::Rest do
45
45
  value = generate_text
46
46
  @neo.create_node_index(index_name)
47
47
  new_node = @neo.create_unique_node(index_name, key, value, {"age" => 31, "name" => "Max"})
48
- new_node["data"]["name"].should == "Max"
49
- new_node["data"]["age"].should == 31
48
+ expect(new_node["data"]["name"]).to eq("Max")
49
+ expect(new_node["data"]["age"]).to eq(31)
50
50
  new_node_id = new_node["self"].split('/').last
51
51
  existing_node = @neo.create_unique_node(index_name, key, value, {"age" => 39, "name" => "Thomas"})
52
- existing_node["self"].split('/').last.should == new_node_id
53
- existing_node["data"]["name"].should == "Max"
54
- existing_node["data"]["age"].should == 31
52
+ expect(existing_node["self"].split('/').last).to eq(new_node_id)
53
+ expect(existing_node["data"]["name"]).to eq("Max")
54
+ expect(existing_node["data"]["age"]).to eq(31)
55
55
  end
56
56
 
57
57
  end
@@ -61,9 +61,9 @@ describe Neography::Rest do
61
61
  new_node = @neo.create_node
62
62
  new_node[:id] = new_node["self"].split('/').last
63
63
  existing_node = @neo.get_node(new_node)
64
- existing_node.should_not be_nil
65
- existing_node.should have_key("self")
66
- existing_node["self"].split('/').last.should == new_node[:id]
64
+ expect(existing_node).not_to be_nil
65
+ expect(existing_node).to have_key("self")
66
+ expect(existing_node["self"].split('/').last).to eq(new_node[:id])
67
67
  end
68
68
 
69
69
  it "raises an error if it tries to get a node that does not exist" do
@@ -78,10 +78,10 @@ describe Neography::Rest do
78
78
  new_node = @neo.create_node("name" => "Ateísmo Sureño")
79
79
  new_node[:id] = new_node["self"].split('/').last
80
80
  existing_node = @neo.get_node(new_node)
81
- existing_node.should_not be_nil
82
- existing_node.should have_key("self")
83
- existing_node["self"].split('/').last.should == new_node[:id]
84
- existing_node["data"]["name"].should == "Ateísmo Sureño"
81
+ expect(existing_node).not_to be_nil
82
+ expect(existing_node).to have_key("self")
83
+ expect(existing_node["self"].split('/').last).to eq(new_node[:id])
84
+ expect(existing_node["data"]["name"]).to eq("Ateísmo Sureño")
85
85
  end
86
86
  end
87
87
 
@@ -90,8 +90,8 @@ describe Neography::Rest do
90
90
  new_node = @neo.create_node
91
91
  @neo.set_node_properties(new_node, {"weight" => 200, "eyes" => "brown"})
92
92
  existing_node = @neo.get_node(new_node)
93
- existing_node["data"]["weight"].should == 200
94
- existing_node["data"]["eyes"].should == "brown"
93
+ expect(existing_node["data"]["weight"]).to eq(200)
94
+ expect(existing_node["data"]["eyes"]).to eq("brown")
95
95
  end
96
96
 
97
97
  it "it fails to set properties on a node that does not exist" do
@@ -109,9 +109,9 @@ describe Neography::Rest do
109
109
  @neo.set_node_properties(new_node, {"weight" => 200, "eyes" => "brown", "hair" => "black"})
110
110
  @neo.reset_node_properties(new_node, {"weight" => 190, "eyes" => "blue"})
111
111
  existing_node = @neo.get_node(new_node)
112
- existing_node["data"]["weight"].should == 190
113
- existing_node["data"]["eyes"].should == "blue"
114
- existing_node["data"]["hair"].should be_nil
112
+ expect(existing_node["data"]["weight"]).to eq(190)
113
+ expect(existing_node["data"]["eyes"]).to eq("blue")
114
+ expect(existing_node["data"]["hair"]).to be_nil
115
115
  end
116
116
 
117
117
  it "it fails to reset properties on a node that does not exist" do
@@ -127,27 +127,27 @@ describe Neography::Rest do
127
127
  it "can get all of a node's properties" do
128
128
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown")
129
129
  node_properties = @neo.get_node_properties(new_node)
130
- node_properties["weight"].should == 200
131
- node_properties["eyes"].should == "brown"
130
+ expect(node_properties["weight"]).to eq(200)
131
+ expect(node_properties["eyes"]).to eq("brown")
132
132
  end
133
133
 
134
134
  it "can get some of a node's properties" do
135
135
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown", "height" => "2m")
136
136
  node_properties = @neo.get_node_properties(new_node, ["weight", "height"])
137
- node_properties["weight"].should == 200
138
- node_properties["height"].should == "2m"
139
- node_properties["eyes"].should be_nil
137
+ expect(node_properties["weight"]).to eq(200)
138
+ expect(node_properties["height"]).to eq("2m")
139
+ expect(node_properties["eyes"]).to be_nil
140
140
  end
141
141
 
142
142
  it "returns nil if it gets the properties on a node that does not have any" do
143
143
  new_node = @neo.create_node
144
- @neo.get_node_properties(new_node).should be_nil
144
+ expect(@neo.get_node_properties(new_node)).to be_nil
145
145
  end
146
146
 
147
147
  it "raises error if it tries to get some of the properties on a node that does not have any" do
148
148
  new_node = @neo.create_node
149
149
  expect {
150
- @neo.get_node_properties(new_node, ["weight", "height"]).should be_nil
150
+ expect(@neo.get_node_properties(new_node, ["weight", "height"])).to be_nil
151
151
  }.to raise_error Neography::NoSuchPropertyException
152
152
  end
153
153
 
@@ -155,7 +155,7 @@ describe Neography::Rest do
155
155
  new_node = @neo.create_node
156
156
  fake_node = new_node["self"].split('/').last.to_i + 1000
157
157
  expect {
158
- @neo.get_node_properties(fake_node).should be_nil
158
+ expect(@neo.get_node_properties(fake_node)).to be_nil
159
159
  }.to raise_error Neography::NodeNotFoundException
160
160
  end
161
161
  end
@@ -164,14 +164,14 @@ describe Neography::Rest do
164
164
  it "can remove a node's properties" do
165
165
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown")
166
166
  @neo.remove_node_properties(new_node)
167
- @neo.get_node_properties(new_node).should be_nil
167
+ expect(@neo.get_node_properties(new_node)).to be_nil
168
168
  end
169
169
 
170
170
  it "raises error if it fails to remove the properties of a node that does not exist" do
171
171
  new_node = @neo.create_node
172
172
  fake_node = new_node["self"].split('/').last.to_i + 1000
173
173
  expect {
174
- @neo.remove_node_properties(fake_node).should be_nil
174
+ expect(@neo.remove_node_properties(fake_node)).to be_nil
175
175
  }.to raise_error Neography::NodeNotFoundException
176
176
  end
177
177
 
@@ -179,23 +179,23 @@ describe Neography::Rest do
179
179
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown")
180
180
  @neo.remove_node_properties(new_node, "weight")
181
181
  node_properties = @neo.get_node_properties(new_node)
182
- node_properties["weight"].should be_nil
183
- node_properties["eyes"].should == "brown"
182
+ expect(node_properties["weight"]).to be_nil
183
+ expect(node_properties["eyes"]).to eq("brown")
184
184
  end
185
185
 
186
186
  it "can remove more than one property" do
187
187
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown", "height" => "2m")
188
188
  @neo.remove_node_properties(new_node, ["weight", "eyes"])
189
189
  node_properties = @neo.get_node_properties(new_node)
190
- node_properties["weight"].should be_nil
191
- node_properties["eyes"].should be_nil
190
+ expect(node_properties["weight"]).to be_nil
191
+ expect(node_properties["eyes"]).to be_nil
192
192
  end
193
193
  end
194
194
 
195
195
  describe "delete_node" do
196
196
  it "can delete an unrelated node" do
197
197
  new_node = @neo.create_node
198
- @neo.delete_node(new_node).should be_nil
198
+ expect(@neo.delete_node(new_node)).to be_nil
199
199
  expect {
200
200
  @neo.get_node(new_node)
201
201
  }.to raise_error Neography::NodeNotFoundException
@@ -206,28 +206,28 @@ describe Neography::Rest do
206
206
  new_node2 = @neo.create_node
207
207
  @neo.create_relationship("friends", new_node1, new_node2)
208
208
  expect {
209
- @neo.delete_node(new_node1).should be_nil
209
+ expect(@neo.delete_node(new_node1)).to be_nil
210
210
  }.to raise_error Neography::OperationFailureException
211
211
  existing_node = @neo.get_node(new_node1)
212
- existing_node.should_not be_nil
212
+ expect(existing_node).not_to be_nil
213
213
  end
214
214
 
215
215
  it "raises error if it tries to delete a node that does not exist" do
216
216
  new_node = @neo.create_node
217
217
  fake_node = new_node["self"].split('/').last.to_i + 1000
218
218
  expect {
219
- @neo.delete_node(fake_node).should be_nil
219
+ expect(@neo.delete_node(fake_node)).to be_nil
220
220
  }.to raise_error Neography::NodeNotFoundException
221
221
  end
222
222
 
223
223
  it "raises error if it tries to delete a node that has already been deleted" do
224
224
  new_node = @neo.create_node
225
- @neo.delete_node(new_node).should be_nil
225
+ expect(@neo.delete_node(new_node)).to be_nil
226
226
  expect {
227
227
  existing_node = @neo.get_node(new_node)
228
228
  }.to raise_error Neography::NodeNotFoundException
229
229
  expect {
230
- @neo.delete_node(new_node).should be_nil
230
+ expect(@neo.delete_node(new_node)).to be_nil
231
231
  }.to raise_error Neography::NodeNotFoundException
232
232
  end
233
233
  end
@@ -235,7 +235,7 @@ describe Neography::Rest do
235
235
  describe "delete_node!" do
236
236
  it "can delete an unrelated node" do
237
237
  new_node = @neo.create_node
238
- @neo.delete_node!(new_node).should be_nil
238
+ expect(@neo.delete_node!(new_node)).to be_nil
239
239
  expect {
240
240
  existing_node = @neo.get_node(new_node)
241
241
  }.to raise_error Neography::NodeNotFoundException
@@ -245,7 +245,7 @@ describe Neography::Rest do
245
245
  new_node1 = @neo.create_node
246
246
  new_node2 = @neo.create_node
247
247
  @neo.create_relationship("friends", new_node1, new_node2)
248
- @neo.delete_node!(new_node1).should be_nil
248
+ expect(@neo.delete_node!(new_node1)).to be_nil
249
249
  expect {
250
250
  existing_node = @neo.get_node(new_node1)
251
251
  }.to raise_error Neography::NodeNotFoundException
@@ -255,18 +255,18 @@ describe Neography::Rest do
255
255
  new_node = @neo.create_node
256
256
  fake_node = new_node["self"].split('/').last.to_i + 1000
257
257
  expect {
258
- @neo.delete_node!(fake_node).should be_nil
258
+ expect(@neo.delete_node!(fake_node)).to be_nil
259
259
  }.to raise_error Neography::NodeNotFoundException
260
260
  end
261
261
 
262
262
  it "raises error if it tries to delete a node that has already been deleted" do
263
263
  new_node = @neo.create_node
264
- @neo.delete_node!(new_node).should be_nil
264
+ expect(@neo.delete_node!(new_node)).to be_nil
265
265
  expect {
266
266
  existing_node = @neo.get_node(new_node)
267
267
  }.to raise_error Neography::NodeNotFoundException
268
268
  expect {
269
- @neo.delete_node!(new_node).should be_nil
269
+ expect(@neo.delete_node!(new_node)).to be_nil
270
270
  }.to raise_error Neography::NodeNotFoundException
271
271
  end
272
272
  end
@@ -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)
13
13
  existing_relationships = @neo.get_node_relationships_to(new_node1, new_node2)
14
- existing_relationships[0].should_not be_nil
15
- existing_relationships[0].should have_key("self")
16
- existing_relationships[0]["self"].should == new_relationship["self"]
14
+ expect(existing_relationships[0]).not_to be_nil
15
+ expect(existing_relationships[0]).to have_key("self")
16
+ expect(existing_relationships[0]["self"]).to eq(new_relationship["self"])
17
17
  end
18
18
 
19
19
  it "returns empty array if it tries to get a relationship that does not exist" do
@@ -22,7 +22,7 @@ describe Neography::Rest do
22
22
  new_node3 = @neo.create_node
23
23
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2)
24
24
  existing_relationship = @neo.get_node_relationships_to(new_node1, new_node3)
25
- existing_relationship.should be_empty
25
+ expect(existing_relationship).to be_empty
26
26
  end
27
27
  end
28
28
 
@@ -32,12 +32,12 @@ describe Neography::Rest do
32
32
  new_node2 = @neo.create_node
33
33
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
34
34
  relationships = @neo.get_node_relationships_to(new_node1, new_node2)
35
- relationships.should_not be_nil
36
- relationships[0]["start"].should == new_node1["self"]
37
- relationships[0]["end"].should == new_node2["self"]
38
- relationships[0]["type"].should == "friends"
39
- relationships[0]["data"]["met"].should == "college"
40
- relationships[0]["data"]["since"].should == '10-1-2005'
35
+ expect(relationships).not_to be_nil
36
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
37
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
38
+ expect(relationships[0]["type"]).to eq("friends")
39
+ expect(relationships[0]["data"]["met"]).to eq("college")
40
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
41
41
  end
42
42
 
43
43
  it "can get a node's multiple relationships" do
@@ -47,17 +47,17 @@ describe Neography::Rest do
47
47
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
48
48
  new_relationship = @neo.create_relationship("enemies", new_node1, new_node2, {"since" => '10-2-2010', "met" => "work"})
49
49
  relationships = @neo.get_node_relationships_to(new_node1, new_node2)
50
- relationships.should_not be_nil
51
- relationships[0]["start"].should == new_node1["self"]
52
- relationships[0]["end"].should == new_node2["self"]
53
- relationships[0]["type"].should == "friends"
54
- relationships[0]["data"]["met"].should == "college"
55
- relationships[0]["data"]["since"].should == '10-1-2005'
56
- relationships[1]["start"].should == new_node1["self"]
57
- relationships[1]["end"].should == new_node2["self"]
58
- relationships[1]["type"].should == "enemies"
59
- relationships[1]["data"]["met"].should == "work"
60
- relationships[1]["data"]["since"].should == '10-2-2010'
50
+ expect(relationships).not_to be_nil
51
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
52
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
53
+ expect(relationships[0]["type"]).to eq("friends")
54
+ expect(relationships[0]["data"]["met"]).to eq("college")
55
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
56
+ expect(relationships[1]["start"]).to eq(new_node1["self"])
57
+ expect(relationships[1]["end"]).to eq(new_node2["self"])
58
+ expect(relationships[1]["type"]).to eq("enemies")
59
+ expect(relationships[1]["data"]["met"]).to eq("work")
60
+ expect(relationships[1]["data"]["since"]).to eq('10-2-2010')
61
61
  end
62
62
 
63
63
  it "can get all of a node's outgoing relationship" do
@@ -67,13 +67,13 @@ describe Neography::Rest do
67
67
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
68
68
  new_relationship = @neo.create_relationship("enemies", new_node2, new_node1, {"since" => '10-2-2010', "met" => "work"})
69
69
  relationships = @neo.get_node_relationships_to(new_node1, new_node2, "out")
70
- relationships.should_not be_nil
71
- relationships[0]["start"].should == new_node1["self"]
72
- relationships[0]["end"].should == new_node2["self"]
73
- relationships[0]["type"].should == "friends"
74
- relationships[0]["data"]["met"].should == "college"
75
- relationships[0]["data"]["since"].should == '10-1-2005'
76
- relationships[1].should be_nil
70
+ expect(relationships).not_to be_nil
71
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
72
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
73
+ expect(relationships[0]["type"]).to eq("friends")
74
+ expect(relationships[0]["data"]["met"]).to eq("college")
75
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
76
+ expect(relationships[1]).to be_nil
77
77
  end
78
78
 
79
79
  it "can get all of a node's incoming relationship" do
@@ -83,13 +83,13 @@ describe Neography::Rest do
83
83
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
84
84
  new_relationship = @neo.create_relationship("enemies", new_node3, new_node1, {"since" => '10-2-2010', "met" => "work"})
85
85
  relationships = @neo.get_node_relationships_to(new_node1, new_node3, "in")
86
- relationships.should_not be_nil
87
- relationships[0]["start"].should == new_node3["self"]
88
- relationships[0]["end"].should == new_node1["self"]
89
- relationships[0]["type"].should == "enemies"
90
- relationships[0]["data"]["met"].should == "work"
91
- relationships[0]["data"]["since"].should == '10-2-2010'
92
- relationships[1].should be_nil
86
+ expect(relationships).not_to be_nil
87
+ expect(relationships[0]["start"]).to eq(new_node3["self"])
88
+ expect(relationships[0]["end"]).to eq(new_node1["self"])
89
+ expect(relationships[0]["type"]).to eq("enemies")
90
+ expect(relationships[0]["data"]["met"]).to eq("work")
91
+ expect(relationships[0]["data"]["since"]).to eq('10-2-2010')
92
+ expect(relationships[1]).to be_nil
93
93
  end
94
94
 
95
95
  it "can get a specific type of node relationships" do
@@ -99,13 +99,13 @@ describe Neography::Rest do
99
99
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2005', "met" => "college"})
100
100
  new_relationship = @neo.create_relationship("friends", new_node1, new_node3, {"since" => '10-2-2010', "met" => "work"})
101
101
  relationships = @neo.get_node_relationships_to(new_node1, new_node2, "all", "friends")
102
- relationships.should_not be_nil
103
- relationships[0]["start"].should == new_node1["self"]
104
- relationships[0]["end"].should == new_node2["self"]
105
- relationships[0]["type"].should == "friends"
106
- relationships[0]["data"]["met"].should == "college"
107
- relationships[0]["data"]["since"].should == '10-1-2005'
108
- relationships[1].should be_nil
102
+ expect(relationships).not_to be_nil
103
+ expect(relationships[0]["start"]).to eq(new_node1["self"])
104
+ expect(relationships[0]["end"]).to eq(new_node2["self"])
105
+ expect(relationships[0]["type"]).to eq("friends")
106
+ expect(relationships[0]["data"]["met"]).to eq("college")
107
+ expect(relationships[0]["data"]["since"]).to eq('10-1-2005')
108
+ expect(relationships[1]).to be_nil
109
109
  end
110
110
 
111
111
  it "can get a specific type and direction of a node relationships" do
@@ -117,20 +117,20 @@ describe Neography::Rest do
117
117
  new_relationship = @neo.create_relationship("enemies", new_node1, new_node3, {"since" => '10-2-2010', "met" => "work"})
118
118
  new_relationship = @neo.create_relationship("enemies", new_node4, new_node1, {"since" => '10-3-2010', "met" => "gym"})
119
119
  relationships = @neo.get_node_relationships_to(new_node1, new_node4, "in", "enemies")
120
- relationships.should_not be_nil
121
- relationships[0]["start"].should == new_node4["self"]
122
- relationships[0]["end"].should == new_node1["self"]
123
- relationships[0]["type"].should == "enemies"
124
- relationships[0]["data"]["met"].should == "gym"
125
- relationships[0]["data"]["since"].should == '10-3-2010'
126
- relationships[1].should be_nil
120
+ expect(relationships).not_to be_nil
121
+ expect(relationships[0]["start"]).to eq(new_node4["self"])
122
+ expect(relationships[0]["end"]).to eq(new_node1["self"])
123
+ expect(relationships[0]["type"]).to eq("enemies")
124
+ expect(relationships[0]["data"]["met"]).to eq("gym")
125
+ expect(relationships[0]["data"]["since"]).to eq('10-3-2010')
126
+ expect(relationships[1]).to be_nil
127
127
  end
128
128
 
129
129
  it "returns nil if there are no relationships" do
130
130
  new_node1 = @neo.create_node
131
131
  new_node2 = @neo.create_node
132
132
  relationships = @neo.get_node_relationships_to(new_node1, new_node2)
133
- relationships.should be_empty
133
+ expect(relationships).to be_empty
134
134
  end
135
135
  end
136
136