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
@@ -21,8 +21,8 @@ describe Neography::NodePath do
21
21
  johnathan, mark, phill, mary = create_nodes
22
22
 
23
23
  johnathan.all_paths_to(mary).incoming(:friends).depth(4).nodes.each do |path|
24
- path.map{|n| n.is_a?(Neography::Node).should be_true}
25
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
24
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
25
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
26
26
  end
27
27
  end
28
28
 
@@ -30,8 +30,8 @@ describe Neography::NodePath do
30
30
  johnathan, mark, phill, mary = create_nodes
31
31
 
32
32
  johnathan.all_paths_to(mary).incoming(:friends).depth(4).rels.each do |path|
33
- path.map{|n| n.is_a?(Neography::Node).should be_false}
34
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
33
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
34
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
35
35
  end
36
36
  end
37
37
 
@@ -41,9 +41,9 @@ describe Neography::NodePath do
41
41
  johnathan.all_paths_to(mary).incoming(:friends).depth(4).each do |path|
42
42
  path.each_with_index do |n,i|
43
43
  if i.even?
44
- n.is_a?(Neography::Node).should be_true
44
+ expect(n.is_a?(Neography::Node)).to be true
45
45
  else
46
- n.is_a?(Neography::Relationship).should be_true
46
+ expect(n.is_a?(Neography::Relationship)).to be true
47
47
  end
48
48
  end
49
49
  end
@@ -55,8 +55,8 @@ describe Neography::NodePath do
55
55
  johnathan, mark, phill, mary = create_nodes
56
56
 
57
57
  johnathan.all_simple_paths_to(mary).incoming(:friends).depth(4).nodes.each do |path|
58
- path.map{|n| n.is_a?(Neography::Node).should be_true}
59
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
58
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
59
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
60
60
  end
61
61
  end
62
62
 
@@ -64,8 +64,8 @@ describe Neography::NodePath do
64
64
  johnathan, mark, phill, mary = create_nodes
65
65
 
66
66
  johnathan.all_simple_paths_to(mary).incoming(:friends).depth(4).rels.each do |path|
67
- path.map{|n| n.is_a?(Neography::Node).should be_false}
68
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
67
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
68
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
69
69
  end
70
70
  end
71
71
 
@@ -75,9 +75,9 @@ describe Neography::NodePath do
75
75
  johnathan.all_simple_paths_to(mary).incoming(:friends).depth(4).each do |path|
76
76
  path.each_with_index do |n,i|
77
77
  if i.even?
78
- n.is_a?(Neography::Node).should be_true
78
+ expect(n.is_a?(Neography::Node)).to be true
79
79
  else
80
- n.is_a?(Neography::Relationship).should be_true
80
+ expect(n.is_a?(Neography::Relationship)).to be true
81
81
  end
82
82
  end
83
83
  end
@@ -89,8 +89,8 @@ describe Neography::NodePath do
89
89
  johnathan, mark, phill, mary = create_nodes
90
90
 
91
91
  johnathan.all_shortest_paths_to(mary).incoming(:friends).depth(4).nodes.each do |path|
92
- path.map{|n| n.is_a?(Neography::Node).should be_true}
93
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
92
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
93
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
94
94
  end
95
95
  end
96
96
 
@@ -98,8 +98,8 @@ describe Neography::NodePath do
98
98
  johnathan, mark, phill, mary = create_nodes
99
99
 
100
100
  johnathan.all_shortest_paths_to(mary).incoming(:friends).depth(4).rels.each do |path|
101
- path.map{|n| n.is_a?(Neography::Node).should be_false}
102
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
101
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
102
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
103
103
  end
104
104
  end
105
105
 
@@ -109,9 +109,9 @@ describe Neography::NodePath do
109
109
  johnathan.all_shortest_paths_to(mary).incoming(:friends).depth(4).each do |path|
110
110
  path.each_with_index do |n,i|
111
111
  if i.even?
112
- n.is_a?(Neography::Node).should be_true
112
+ expect(n.is_a?(Neography::Node)).to be true
113
113
  else
114
- n.is_a?(Neography::Relationship).should be_true
114
+ expect(n.is_a?(Neography::Relationship)).to be true
115
115
  end
116
116
  end
117
117
  end
@@ -123,8 +123,8 @@ describe Neography::NodePath do
123
123
  johnathan, mark, phill, mary = create_nodes
124
124
 
125
125
  johnathan.path_to(mary).incoming(:friends).depth(4).nodes.each do |path|
126
- path.map{|n| n.is_a?(Neography::Node).should be_true}
127
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
126
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
127
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
128
128
  end
129
129
  end
130
130
 
@@ -132,8 +132,8 @@ describe Neography::NodePath do
132
132
  johnathan, mark, phill, mary = create_nodes
133
133
 
134
134
  johnathan.path_to(mary).incoming(:friends).depth(4).rels.each do |path|
135
- path.map{|n| n.is_a?(Neography::Node).should be_false}
136
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
135
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
136
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
137
137
  end
138
138
  end
139
139
 
@@ -143,9 +143,9 @@ describe Neography::NodePath do
143
143
  johnathan.path_to(mary).incoming(:friends).depth(4).each do |path|
144
144
  path.each_with_index do |n,i|
145
145
  if i.even?
146
- n.is_a?(Neography::Node).should be_true
146
+ expect(n.is_a?(Neography::Node)).to be true
147
147
  else
148
- n.is_a?(Neography::Relationship).should be_true
148
+ expect(n.is_a?(Neography::Relationship)).to be true
149
149
  end
150
150
  end
151
151
  end
@@ -157,8 +157,8 @@ describe Neography::NodePath do
157
157
  johnathan, mark, phill, mary = create_nodes
158
158
 
159
159
  johnathan.simple_path_to(mary).incoming(:friends).depth(4).nodes.each do |path|
160
- path.map{|n| n.is_a?(Neography::Node).should be_true}
161
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
160
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
161
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
162
162
  end
163
163
  end
164
164
 
@@ -166,8 +166,8 @@ describe Neography::NodePath do
166
166
  johnathan, mark, phill, mary = create_nodes
167
167
 
168
168
  johnathan.simple_path_to(mary).incoming(:friends).depth(4).rels.each do |path|
169
- path.map{|n| n.is_a?(Neography::Node).should be_false}
170
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
169
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
170
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
171
171
  end
172
172
  end
173
173
 
@@ -177,9 +177,9 @@ describe Neography::NodePath do
177
177
  johnathan.simple_path_to(mary).incoming(:friends).depth(4).each do |path|
178
178
  path.each_with_index do |n,i|
179
179
  if i.even?
180
- n.is_a?(Neography::Node).should be_true
180
+ expect(n.is_a?(Neography::Node)).to be true
181
181
  else
182
- n.is_a?(Neography::Relationship).should be_true
182
+ expect(n.is_a?(Neography::Relationship)).to be true
183
183
  end
184
184
  end
185
185
  end
@@ -191,8 +191,8 @@ describe Neography::NodePath do
191
191
  johnathan, mark, phill, mary = create_nodes
192
192
 
193
193
  johnathan.shortest_path_to(mary).incoming(:friends).depth(4).nodes.each do |path|
194
- path.map{|n| n.is_a?(Neography::Node).should be_true}
195
- path.map{|n| n.is_a?(Neography::Relationship).should be_false}
194
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be true}
195
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be false}
196
196
  end
197
197
  end
198
198
 
@@ -200,8 +200,8 @@ describe Neography::NodePath do
200
200
  johnathan, mark, phill, mary = create_nodes
201
201
 
202
202
  johnathan.shortest_path_to(mary).incoming(:friends).depth(4).rels.each do |path|
203
- path.map{|n| n.is_a?(Neography::Node).should be_false}
204
- path.map{|n| n.is_a?(Neography::Relationship).should be_true}
203
+ path.map{|n| expect(n.is_a?(Neography::Node)).to be false}
204
+ path.map{|n| expect(n.is_a?(Neography::Relationship)).to be true}
205
205
  end
206
206
  end
207
207
 
@@ -211,9 +211,9 @@ describe Neography::NodePath do
211
211
  johnathan.shortest_path_to(mary).incoming(:friends).depth(4).each do |path|
212
212
  path.each_with_index do |n,i|
213
213
  if i.even?
214
- n.is_a?(Neography::Node).should be_true
214
+ expect(n.is_a?(Neography::Node)).to be true
215
215
  else
216
- n.is_a?(Neography::Relationship).should be_true
216
+ expect(n.is_a?(Neography::Relationship)).to be true
217
217
  end
218
218
  end
219
219
  end
@@ -38,7 +38,7 @@ describe Neography::NodeRelationship do
38
38
  a.outgoing(:friends) << other_node
39
39
 
40
40
  # then
41
- a.outgoing(:friends).first.should == other_node
41
+ expect(a.outgoing(:friends).first).to eq(other_node)
42
42
  end
43
43
 
44
44
  it "#outgoing(:friends) << b << c creates an outgoing relationship of type :friends" do
@@ -50,46 +50,46 @@ describe Neography::NodeRelationship do
50
50
  a.outgoing(:friends) << b << c
51
51
 
52
52
  # then
53
- a.outgoing(:friends).should include(b,c)
53
+ expect(a.outgoing(:friends)).to include(b,c)
54
54
  end
55
55
 
56
56
  it "#outgoing returns all incoming nodes of any type" do
57
57
  a,b,c,d,e,f = create_nodes
58
58
 
59
- b.outgoing.should include(c,f,d)
60
- [*b.outgoing].size.should == 4 #c is related by both work and friends
59
+ expect(b.outgoing).to include(c,f,d)
60
+ expect([*b.outgoing].size).to eq(4) #c is related by both work and friends
61
61
  end
62
62
 
63
63
  it "#outgoing(type) should only return outgoing nodes of the given type of depth one" do
64
64
  a,b,c,d = create_nodes
65
- b.outgoing(:work).should include(c,d)
66
- [*b.outgoing(:work)].size.should == 2
65
+ expect(b.outgoing(:work)).to include(c,d)
66
+ expect([*b.outgoing(:work)].size).to eq(2)
67
67
  end
68
68
 
69
69
  it "#outgoing(type1).outgoing(type2) should return outgoing nodes of the given types" do
70
70
  a,b,c,d,e,f = create_nodes
71
71
  nodes = b.outgoing(:work).outgoing(:friends)
72
72
 
73
- nodes.should include(c,d,f)
74
- nodes.size.should == 4 #c is related by both work and friends
73
+ expect(nodes).to include(c,d,f)
74
+ expect(nodes.size).to eq(4) #c is related by both work and friends
75
75
  end
76
76
 
77
77
  it "#outgoing(type).depth(4) should only return outgoing nodes of the given type and depth" do
78
78
  a,b,c,d,e = create_nodes
79
- [*b.outgoing(:work).depth(4)].size.should == 3
80
- b.outgoing(:work).depth(4).should include(c,d,e)
79
+ expect([*b.outgoing(:work).depth(4)].size).to eq(3)
80
+ expect(b.outgoing(:work).depth(4)).to include(c,d,e)
81
81
  end
82
82
 
83
83
  it "#outgoing(type).depth(4).include_start_node should also include the start node" do
84
84
  a,b,c,d,e = create_nodes
85
- [*b.outgoing(:work).depth(4).include_start_node].size.should == 4
86
- b.outgoing(:work).depth(4).include_start_node.should include(b,c,d,e)
85
+ expect([*b.outgoing(:work).depth(4).include_start_node].size).to eq(4)
86
+ expect(b.outgoing(:work).depth(4).include_start_node).to include(b,c,d,e)
87
87
  end
88
88
 
89
89
  it "#outgoing(type).depth(:all) should traverse at any depth" do
90
90
  a,b,c,d,e = create_nodes
91
- [*b.outgoing(:work).depth(:all)].size.should == 3
92
- b.outgoing(:work).depth(:all).should include(c,d,e)
91
+ expect([*b.outgoing(:work).depth(:all)].size).to eq(3)
92
+ expect(b.outgoing(:work).depth(:all)).to include(c,d,e)
93
93
  end
94
94
  end
95
95
 
@@ -102,7 +102,7 @@ describe Neography::NodeRelationship do
102
102
  a.incoming(:friends) << other_node
103
103
 
104
104
  # then
105
- a.incoming(:friends).first.should == other_node
105
+ expect(a.incoming(:friends).first).to eq(other_node)
106
106
  end
107
107
 
108
108
  it "#incoming(:friends) << b << c creates an incoming relationship of type :friends" do
@@ -114,26 +114,26 @@ describe Neography::NodeRelationship do
114
114
  a.incoming(:friends) << b << c
115
115
 
116
116
  # then
117
- a.incoming(:friends).should include(b,c)
117
+ expect(a.incoming(:friends)).to include(b,c)
118
118
  end
119
119
 
120
120
  it "#incoming returns all incoming nodes of any type" do
121
121
  a,b,c,d,e,f = create_nodes
122
122
 
123
- b.incoming.should include(a)
124
- [*b.incoming].size.should == 1
123
+ expect(b.incoming).to include(a)
124
+ expect([*b.incoming].size).to eq(1)
125
125
  end
126
126
 
127
127
  it "#incoming(type).depth(2) should only return outgoing nodes of the given type and depth" do
128
128
  a,b,c,d,e = create_nodes
129
- [*e.incoming(:work).depth(2)].size.should == 2
130
- e.incoming(:work).depth(2).should include(b,d)
129
+ expect([*e.incoming(:work).depth(2)].size).to eq(2)
130
+ expect(e.incoming(:work).depth(2)).to include(b,d)
131
131
  end
132
132
 
133
133
  it "#incoming(type) should only return incoming nodes of the given type of depth one" do
134
134
  a,b,c,d = create_nodes
135
- c.incoming(:work).should include(b)
136
- [*c.incoming(:work)].size.should == 1
135
+ expect(c.incoming(:work)).to include(b)
136
+ expect([*c.incoming(:work)].size).to eq(1)
137
137
  end
138
138
  end
139
139
 
@@ -144,37 +144,37 @@ describe Neography::NodeRelationship do
144
144
 
145
145
  # when
146
146
  a.both(:friends) << other_node
147
- a.incoming(:friends).first.should == other_node
148
- a.outgoing(:friends).first.should == other_node
147
+ expect(a.incoming(:friends).first).to eq(other_node)
148
+ expect(a.outgoing(:friends).first).to eq(other_node)
149
149
  end
150
150
 
151
151
  it "#both returns all incoming and outgoing nodes of any type" do
152
152
  a,b,c,d,e,f = create_nodes
153
153
 
154
- b.both.should include(a,c,d,f)
155
- [*b.both].size.should == 5 #c is related by both work and friends
156
- b.incoming.should include(a)
157
- b.outgoing.should include(c)
154
+ expect(b.both).to include(a,c,d,f)
155
+ expect([*b.both].size).to eq(5) #c is related by both work and friends
156
+ expect(b.incoming).to include(a)
157
+ expect(b.outgoing).to include(c)
158
158
  end
159
159
 
160
160
  it "#both returns an empty array for unconnected nodes" do
161
161
  a = Neography::Node.create
162
- a.both.size.should == 0
162
+ expect(a.both.size).to eq(0)
163
163
  end
164
164
 
165
165
  it "#both(type) should return both incoming and outgoing nodes of the given type of depth one" do
166
166
  a,b,c,d,e,f = create_nodes
167
167
 
168
- b.both(:friends).should include(a,c,f)
169
- [*b.both(:friends)].size.should == 3
168
+ expect(b.both(:friends)).to include(a,c,f)
169
+ expect([*b.both(:friends)].size).to eq(3)
170
170
  end
171
171
 
172
172
  it "#outgoing and #incoming can be combined to traverse several relationship types" do
173
173
  a,b,c,d,e = create_nodes
174
174
  nodes = [*b.incoming(:friends).outgoing(:work)]
175
175
 
176
- nodes.should include(a,c,d)
177
- nodes.should_not include(b,e)
176
+ expect(nodes).to include(a,c,d)
177
+ expect(nodes).not_to include(b,e)
178
178
  end
179
179
  end
180
180
 
@@ -182,22 +182,22 @@ describe Neography::NodeRelationship do
182
182
  describe "prune" do
183
183
  it "#prune, if it returns true the traversal will be stop for that path" do
184
184
  a, b, c, d, e = create_nodes
185
- [*b.outgoing(:work).depth(4)].size.should == 3
186
- b.outgoing(:work).depth(4).should include(c,d,e)
185
+ expect([*b.outgoing(:work).depth(4)].size).to eq(3)
186
+ expect(b.outgoing(:work).depth(4)).to include(c,d,e)
187
187
 
188
- [*b.outgoing(:work).prune("position.endNode().getProperty('name') == 'd';")].size.should == 2
189
- b.outgoing(:work).prune("position.endNode().getProperty('name') == 'd';").should include(c,d)
188
+ expect([*b.outgoing(:work).prune("position.endNode().getProperty('name') == 'd';")].size).to eq(2)
189
+ expect(b.outgoing(:work).prune("position.endNode().getProperty('name') == 'd';")).to include(c,d)
190
190
  end
191
191
  end
192
192
 
193
193
  describe "filter" do
194
194
  it "#filter, if it returns true the node will be included in the return results" do
195
195
  a, b, c, d, e = create_nodes
196
- [*b.outgoing(:work).depth(4)].size.should == 3
197
- b.outgoing(:work).depth(4).should include(c,d,e)
196
+ expect([*b.outgoing(:work).depth(4)].size).to eq(3)
197
+ expect(b.outgoing(:work).depth(4)).to include(c,d,e)
198
198
 
199
- [*b.outgoing(:work).depth(4).filter("position.length() == 2;")].size.should == 1
200
- b.outgoing(:work).depth(4).filter("position.length() == 2;").should include(e)
199
+ expect([*b.outgoing(:work).depth(4).filter("position.length() == 2;")].size).to eq(1)
200
+ expect(b.outgoing(:work).depth(4).filter("position.length() == 2;")).to include(e)
201
201
  end
202
202
  end
203
203
 
@@ -209,8 +209,8 @@ describe Neography::NodeRelationship do
209
209
  r1 = Neography::Relationship.create(:friend, a, b)
210
210
  Neography::Relationship.create(:friend, a, c)
211
211
 
212
- a.rels.to_other(b).size.should == 1
213
- a.rels.to_other(b).should include(r1)
212
+ expect(a.rels.to_other(b).size).to eq(1)
213
+ expect(a.rels.to_other(b)).to include(r1)
214
214
  end
215
215
 
216
216
  it "#rels returns an RelationshipTraverser which provides a method for deleting all the relationships" do
@@ -220,11 +220,11 @@ describe Neography::NodeRelationship do
220
220
  r1 = Neography::Relationship.create(:friend, a, b)
221
221
  r2 = Neography::Relationship.create(:friend, a, c)
222
222
 
223
- a.rel?(:friend).should be_true
223
+ expect(a.rel?(:friend)).to be true
224
224
  a.rels.del
225
- a.rel?(:friend).should be_false
226
- r1.exist?.should be_false
227
- r2.exist?.should be_false
225
+ expect(a.rel?(:friend)).to be false
226
+ expect(r1.exist?).to be false
227
+ expect(r2.exist?).to be false
228
228
  end
229
229
 
230
230
  it "#rels returns an RelationshipTraverser with methods #del and #to_other which can be combined to only delete a subset of the relationships" do
@@ -233,19 +233,19 @@ describe Neography::NodeRelationship do
233
233
  c = Neography::Node.create
234
234
  r1 = Neography::Relationship.create(:friend, a, b)
235
235
  r2 = Neography::Relationship.create(:friend, a, c)
236
- r1.exist?.should be_true
237
- r2.exist?.should be_true
236
+ expect(r1.exist?).to be true
237
+ expect(r2.exist?).to be true
238
238
  a.rels.to_other(c).del
239
- r1.exist?.should be_true
240
- r2.exist?.should be_false
239
+ expect(r1.exist?).to be true
240
+ expect(r2.exist?).to be false
241
241
  end
242
242
 
243
243
  it "#rels should return both incoming and outgoing relationship of any type of depth one" do
244
244
  a,b,c,d,e,f = create_nodes
245
- b.rels.size.should == 5
245
+ expect(b.rels.size).to eq(5)
246
246
  nodes = b.rels.collect{|r| r.other_node(b)}
247
- nodes.should include(a,c,d,f)
248
- nodes.should_not include(e)
247
+ expect(nodes).to include(a,c,d,f)
248
+ expect(nodes).not_to include(e)
249
249
  end
250
250
 
251
251
  it "#rels(:friends) should return both incoming and outgoing relationships of given type of depth one" do
@@ -256,10 +256,10 @@ describe Neography::NodeRelationship do
256
256
  rels = [*b.rels(:friends)]
257
257
 
258
258
  # then
259
- rels.size.should == 3
259
+ expect(rels.size).to eq(3)
260
260
  nodes = rels.collect{|r| r.end_node}
261
- nodes.should include(b,c,f)
262
- nodes.should_not include(a,d,e)
261
+ expect(nodes).to include(b,c,f)
262
+ expect(nodes).not_to include(a,d,e)
263
263
  end
264
264
 
265
265
  it "#rels(:friends).outgoing should return only outgoing relationships of given type of depth one" do
@@ -270,10 +270,10 @@ describe Neography::NodeRelationship do
270
270
  rels = [*b.rels(:friends).outgoing]
271
271
 
272
272
  # then
273
- rels.size.should == 2
273
+ expect(rels.size).to eq(2)
274
274
  nodes = rels.collect{|r| r.end_node}
275
- nodes.should include(c,f)
276
- nodes.should_not include(a,b,d,e)
275
+ expect(nodes).to include(c,f)
276
+ expect(nodes).not_to include(a,b,d,e)
277
277
  end
278
278
 
279
279
 
@@ -285,10 +285,10 @@ describe Neography::NodeRelationship do
285
285
  rels = [*b.rels(:friends).incoming]
286
286
 
287
287
  # then
288
- rels.size.should == 1
288
+ expect(rels.size).to eq(1)
289
289
  nodes = rels.collect{|r| r.start_node}
290
- nodes.should include(a)
291
- nodes.should_not include(b,c,d,e)
290
+ expect(nodes).to include(a)
291
+ expect(nodes).not_to include(b,c,d,e)
292
292
  end
293
293
 
294
294
  it "#rels(:friends,:work) should return both incoming and outgoing relationships of given types of depth one" do
@@ -299,10 +299,10 @@ describe Neography::NodeRelationship do
299
299
  rels = [*b.rels(:friends,:work)]
300
300
 
301
301
  # then
302
- rels.size.should == 5
302
+ expect(rels.size).to eq(5)
303
303
  nodes = rels.collect{|r| r.other_node(b)}
304
- nodes.should include(a,c,d,f)
305
- nodes.should_not include(b,e)
304
+ expect(nodes).to include(a,c,d,f)
305
+ expect(nodes).not_to include(b,e)
306
306
  end
307
307
 
308
308
  it "#rels(:friends,:work).outgoing should return outgoing relationships of given types of depth one" do
@@ -313,10 +313,10 @@ describe Neography::NodeRelationship do
313
313
  rels = [*b.rels(:friends,:work).outgoing]
314
314
 
315
315
  # then
316
- rels.size.should == 4
316
+ expect(rels.size).to eq(4)
317
317
  nodes = rels.collect{|r| r.other_node(b)}
318
- nodes.should include(c,d,f)
319
- nodes.should_not include(a,b,e)
318
+ expect(nodes).to include(c,d,f)
319
+ expect(nodes).not_to include(a,b,e)
320
320
  end
321
321
  end
322
322
 
@@ -325,13 +325,13 @@ describe Neography::NodeRelationship do
325
325
  a = Neography::Node.create
326
326
  b = Neography::Node.create
327
327
  rel = Neography::Relationship.create(:friend, a, b)
328
- a.rel(:outgoing, :friend).should == rel
328
+ expect(a.rel(:outgoing, :friend)).to eq(rel)
329
329
  end
330
330
 
331
331
  it "#rel returns nil if there is no relationship" do
332
332
  a = Neography::Node.create
333
333
  b = Neography::Node.create
334
- a.rel(:outgoing, :friend).should be_empty
334
+ expect(a.rel(:outgoing, :friend)).to be_empty
335
335
  end
336
336
 
337
337
  it "#rel should only return one relationship even if there are more" do
@@ -347,21 +347,21 @@ describe Neography::NodeRelationship do
347
347
  describe "rel?" do
348
348
  it "#rel? returns true if there are any relationships" do
349
349
  n1 = Neography::Node.create
350
- n1.rel?.should be_false
350
+ expect(n1.rel?).to be false
351
351
  n1.outgoing(:foo) << Neography::Node.create
352
352
 
353
- n1.rel?.should be_true
354
- n1.rel?(:bar).should be_false
355
- n1.rel?(:foo).should be_true
356
- n1.rel?(:incoming, :foo).should be_false
357
- n1.rel?(:outgoing, :foo).should be_true
358
- n1.rel?(:foo, :incoming).should be_false
359
- n1.rel?(:foo, :outgoing).should be_true
360
- n1.rel?(:incoming).should be_false
361
- n1.rel?(:outgoing).should be_true
362
- n1.rel?(:both).should be_true
363
- n1.rel?(:all).should be_true
364
- n1.rel?.should be_true
353
+ expect(n1.rel?).to be true
354
+ expect(n1.rel?(:bar)).to be false
355
+ expect(n1.rel?(:foo)).to be true
356
+ expect(n1.rel?(:incoming, :foo)).to be false
357
+ expect(n1.rel?(:outgoing, :foo)).to be true
358
+ expect(n1.rel?(:foo, :incoming)).to be false
359
+ expect(n1.rel?(:foo, :outgoing)).to be true
360
+ expect(n1.rel?(:incoming)).to be false
361
+ expect(n1.rel?(:outgoing)).to be true
362
+ expect(n1.rel?(:both)).to be true
363
+ expect(n1.rel?(:all)).to be true
364
+ expect(n1.rel?).to be true
365
365
  end
366
366
  end
367
367