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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +939 -0
- data/Guardfile +14 -0
- data/README.md +16 -14
- data/lib/neography/connection.rb +1 -0
- data/lib/neography/errors.rb +3 -0
- data/lib/neography/node.rb +21 -25
- data/lib/neography/property.rb +60 -11
- data/lib/neography/property_container.rb +5 -6
- data/lib/neography/rest/batch.rb +10 -0
- data/lib/neography/rest/node_properties.rb +1 -1
- data/lib/neography/version.rb +1 -1
- data/neography.gemspec +4 -2
- data/spec/integration/authorization_spec.rb +4 -4
- data/spec/integration/broken_spatial_spec.rb +6 -6
- data/spec/integration/index_spec.rb +6 -6
- data/spec/integration/neography_spec.rb +1 -1
- data/spec/integration/node_encoding_spec.rb +19 -19
- data/spec/integration/node_path_spec.rb +36 -36
- data/spec/integration/node_relationship_spec.rb +84 -84
- data/spec/integration/node_spec.rb +50 -50
- data/spec/integration/parsing_spec.rb +2 -2
- data/spec/integration/relationship_spec.rb +10 -10
- data/spec/integration/rest_batch_no_streaming_spec.rb +6 -6
- data/spec/integration/rest_batch_spec.rb +209 -188
- data/spec/integration/rest_batch_streaming_spec.rb +8 -8
- data/spec/integration/rest_bulk_spec.rb +23 -23
- data/spec/integration/rest_constraints_spec.rb +17 -17
- data/spec/integration/rest_experimental_spec.rb +2 -2
- data/spec/integration/rest_gremlin_fail_spec.rb +4 -4
- data/spec/integration/rest_header_spec.rb +3 -2
- data/spec/integration/rest_index_spec.rb +76 -76
- data/spec/integration/rest_labels_spec.rb +13 -13
- data/spec/integration/rest_node_spec.rb +50 -50
- data/spec/integration/rest_other_node_relationship_spec.rb +50 -50
- data/spec/integration/rest_path_spec.rb +55 -55
- data/spec/integration/rest_plugin_spec.rb +59 -59
- data/spec/integration/rest_relationship_spec.rb +77 -77
- data/spec/integration/rest_relationship_types_spec.rb +2 -2
- data/spec/integration/rest_schema_index_spec.rb +6 -6
- data/spec/integration/rest_spatial_spec.rb +50 -50
- data/spec/integration/rest_transaction_spec.rb +67 -67
- data/spec/integration/rest_traverse_spec.rb +40 -40
- data/spec/integration/unmanaged_spec.rb +3 -3
- data/spec/matchers.rb +2 -2
- data/spec/neography_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/config_spec.rb +95 -20
- data/spec/unit/connection_spec.rb +40 -40
- data/spec/unit/node_spec.rb +12 -12
- data/spec/unit/properties_spec.rb +174 -29
- data/spec/unit/relationship_spec.rb +16 -16
- data/spec/unit/rest/batch_spec.rb +23 -23
- data/spec/unit/rest/clean_spec.rb +1 -1
- data/spec/unit/rest/constraints_spec.rb +6 -6
- data/spec/unit/rest/cypher_spec.rb +1 -1
- data/spec/unit/rest/extensions_spec.rb +2 -2
- data/spec/unit/rest/gremlin_spec.rb +3 -3
- data/spec/unit/rest/helpers_spec.rb +19 -19
- data/spec/unit/rest/labels_spec.rb +10 -10
- data/spec/unit/rest/node_auto_indexes_spec.rb +13 -13
- data/spec/unit/rest/node_indexes_spec.rb +22 -22
- data/spec/unit/rest/node_paths_spec.rb +7 -7
- data/spec/unit/rest/node_properties_spec.rb +15 -15
- data/spec/unit/rest/node_relationships_spec.rb +10 -10
- data/spec/unit/rest/node_traversal_spec.rb +1 -1
- data/spec/unit/rest/nodes_spec.rb +32 -32
- data/spec/unit/rest/relationship_auto_indexes_spec.rb +12 -12
- data/spec/unit/rest/relationship_indexes_spec.rb +21 -21
- data/spec/unit/rest/relationship_properties_spec.rb +15 -15
- data/spec/unit/rest/relationship_types_spec.rb +1 -1
- data/spec/unit/rest/relationships_spec.rb +2 -2
- data/spec/unit/rest/schema_index_spec.rb +3 -3
- data/spec/unit/rest/transactions_spec.rb +4 -4
- metadata +32 -3
- data/ChangeLog +0 -658
@@ -11,8 +11,8 @@ 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
|
rel_types = @neo.list_relationship_types
|
14
|
-
rel_types.
|
15
|
-
rel_types.
|
14
|
+
expect(rel_types).not_to be_nil
|
15
|
+
expect(rel_types).to include("friends")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -8,8 +8,8 @@ describe Neography::Rest do
|
|
8
8
|
describe "create a schema index" do
|
9
9
|
it "can create a schema index" do
|
10
10
|
si = @neo.create_schema_index("person", ["name"])
|
11
|
-
si.
|
12
|
-
si["property_keys"].
|
11
|
+
expect(si).not_to be_nil
|
12
|
+
expect(si["property_keys"]).to include("name")
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
@@ -17,16 +17,16 @@ describe Neography::Rest do
|
|
17
17
|
describe "list schema indexes" do
|
18
18
|
it "can get a listing of node indexes" do
|
19
19
|
si = @neo.get_schema_index("person")
|
20
|
-
si.
|
21
|
-
si.first["label"].
|
22
|
-
si.first["property_keys"].
|
20
|
+
expect(si).not_to be_nil
|
21
|
+
expect(si.first["label"]).to include("person")
|
22
|
+
expect(si.first["property_keys"]).to include("name")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "drop schema indexes" do
|
27
27
|
it "can drop an existing schema index" do
|
28
28
|
si = @neo.delete_schema_index("person", "name")
|
29
|
-
si.
|
29
|
+
expect(si).to be_nil
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -8,51 +8,51 @@ describe Neography::Rest do
|
|
8
8
|
describe "find the spatial plugin" do
|
9
9
|
it "can get a description of the spatial plugin" do
|
10
10
|
si = @neo.get_spatial
|
11
|
-
si.
|
12
|
-
si["graphdb"]["addEditableLayer"].
|
11
|
+
expect(si).not_to be_nil
|
12
|
+
expect(si["graphdb"]["addEditableLayer"]).not_to be_nil
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "add a point layer" do
|
17
17
|
it "can add a simple point layer" do
|
18
18
|
pl = @neo.add_point_layer("restaurants")
|
19
|
-
pl.
|
20
|
-
pl.first["data"]["layer"].
|
21
|
-
pl.first["data"]["geomencoder_config"].
|
19
|
+
expect(pl).not_to be_nil
|
20
|
+
expect(pl.first["data"]["layer"]).to eq("restaurants")
|
21
|
+
expect(pl.first["data"]["geomencoder_config"]).to eq("lon:lat")
|
22
22
|
end
|
23
23
|
|
24
24
|
it "can add a simple point layer with lat and long" do
|
25
25
|
pl = @neo.add_point_layer("coffee_shops", "latitude", "longitude")
|
26
|
-
pl.
|
27
|
-
pl.first["data"]["layer"].
|
28
|
-
pl.first["data"]["geomencoder_config"].
|
26
|
+
expect(pl).not_to be_nil
|
27
|
+
expect(pl.first["data"]["layer"]).to eq("coffee_shops")
|
28
|
+
expect(pl.first["data"]["geomencoder_config"]).to eq("longitude:latitude")
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "add an editable layer" do
|
33
33
|
it "can add an editable layer" do
|
34
34
|
el = @neo.add_editable_layer("zipcodes", "WKT", "wkt")
|
35
|
-
el.
|
36
|
-
el.first["data"]["layer"].
|
37
|
-
el.first["data"]["geomencoder_config"].
|
35
|
+
expect(el).not_to be_nil
|
36
|
+
expect(el.first["data"]["layer"]).to eq("zipcodes")
|
37
|
+
expect(el.first["data"]["geomencoder_config"]).to eq("wkt")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "get a spatial layer" do
|
42
42
|
it "can get a layer" do
|
43
43
|
sl = @neo.get_layer("restaurants")
|
44
|
-
sl.
|
45
|
-
sl.first["data"]["layer"].
|
44
|
+
expect(sl).not_to be_nil
|
45
|
+
expect(sl.first["data"]["layer"]).to eq("restaurants")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "create a spatial index" do
|
50
50
|
it "can create a spatial index" do
|
51
51
|
index = @neo.create_spatial_index("restaurants")
|
52
|
-
index["provider"].
|
53
|
-
index["geometry_type"].
|
54
|
-
index["lat"].
|
55
|
-
index["lon"].
|
52
|
+
expect(index["provider"]).to eq("spatial")
|
53
|
+
expect(index["geometry_type"]).to eq("point")
|
54
|
+
expect(index["lat"]).to eq("lat")
|
55
|
+
expect(index["lon"]).to eq("lon")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -60,8 +60,8 @@ describe Neography::Rest do
|
|
60
60
|
it "can add a geometry" do
|
61
61
|
geometry = "LINESTRING (15.2 60.1, 15.3 60.1)"
|
62
62
|
geo = @neo.add_geometry_to_layer("zipcodes", geometry)
|
63
|
-
geo.
|
64
|
-
geo.first["data"]["wkt"].
|
63
|
+
expect(geo).not_to be_nil
|
64
|
+
expect(geo.first["data"]["wkt"]).to eq(geometry)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -69,12 +69,12 @@ describe Neography::Rest do
|
|
69
69
|
it "can update a geometry" do
|
70
70
|
geometry = "LINESTRING (15.2 60.1, 15.3 60.1)"
|
71
71
|
geo = @neo.add_geometry_to_layer("zipcodes", geometry)
|
72
|
-
geo.
|
73
|
-
geo.first["data"]["wkt"].
|
72
|
+
expect(geo).not_to be_nil
|
73
|
+
expect(geo.first["data"]["wkt"]).to eq(geometry)
|
74
74
|
geometry = "LINESTRING (14.7 60.1, 15.3 60.1)"
|
75
75
|
existing_geo = @neo.edit_geometry_from_layer("zipcodes", geometry, geo)
|
76
|
-
existing_geo.first["data"]["wkt"].
|
77
|
-
existing_geo.first["self"].split('/').last.to_i.
|
76
|
+
expect(existing_geo.first["data"]["wkt"]).to eq(geometry)
|
77
|
+
expect(existing_geo.first["self"].split('/').last.to_i).to eq(geo.first["self"].split('/').last.to_i)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -82,14 +82,14 @@ describe Neography::Rest do
|
|
82
82
|
it "can add a node to a simple point layer" do
|
83
83
|
properties = {:name => "Max's Restaurant", :lat => 41.8819, :lon => 87.6278}
|
84
84
|
node = @neo.create_node(properties)
|
85
|
-
node.
|
85
|
+
expect(node).not_to be_nil
|
86
86
|
added = @neo.add_node_to_layer("restaurants", node)
|
87
|
-
added.first["data"]["lat"].
|
88
|
-
added.first["data"]["lon"].
|
87
|
+
expect(added.first["data"]["lat"]).to eq(properties[:lat])
|
88
|
+
expect(added.first["data"]["lon"]).to eq(properties[:lon])
|
89
89
|
|
90
90
|
added = @neo.add_node_to_index("restaurants", "dummy", "dummy", node)
|
91
|
-
added["data"]["lat"].
|
92
|
-
added["data"]["lon"].
|
91
|
+
expect(added["data"]["lat"]).to eq(properties[:lat])
|
92
|
+
expect(added["data"]["lon"]).to eq(properties[:lon])
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -97,10 +97,10 @@ describe Neography::Rest do
|
|
97
97
|
it "can find a geometry in a bounding box" do
|
98
98
|
properties = {:name => "Max's Restaurant", :lat => 41.8819, :lon => 87.6278}
|
99
99
|
node = @neo.find_geometries_in_bbox("restaurants", 87.5, 87.7, 41.7, 41.9)
|
100
|
-
node.
|
101
|
-
node.first["data"]["lat"].
|
102
|
-
node.first["data"]["lon"].
|
103
|
-
node.first["data"]["name"].
|
100
|
+
expect(node).not_to be_empty
|
101
|
+
expect(node.first["data"]["lat"]).to eq(properties[:lat])
|
102
|
+
expect(node.first["data"]["lon"]).to eq(properties[:lon])
|
103
|
+
expect(node.first["data"]["name"]).to eq("Max's Restaurant")
|
104
104
|
end
|
105
105
|
|
106
106
|
it "can find a geometry in a bounding box using cypher" do
|
@@ -109,9 +109,9 @@ describe Neography::Rest do
|
|
109
109
|
node = @neo.create_node(properties)
|
110
110
|
added = @neo.add_node_to_index("geombbcypher", "dummy", "dummy", node)
|
111
111
|
existing_node = @neo.execute_query("start node = node:geombbcypher('bbox:[15.0,15.3,60.0,60.2]') return node")
|
112
|
-
existing_node.
|
113
|
-
existing_node["data"][0][0]["data"]["lat"].
|
114
|
-
existing_node["data"][0][0]["data"]["lon"].
|
112
|
+
expect(existing_node).not_to be_empty
|
113
|
+
expect(existing_node["data"][0][0]["data"]["lat"]).to eq(properties[:lat])
|
114
|
+
expect(existing_node["data"][0][0]["data"]["lon"]).to eq(properties[:lon])
|
115
115
|
end
|
116
116
|
|
117
117
|
it "can find a geometry in a bounding box using cypher two" do
|
@@ -120,9 +120,9 @@ describe Neography::Rest do
|
|
120
120
|
node = @neo.create_node(properties)
|
121
121
|
added = @neo.add_node_to_spatial_index("geombbcypher2", node)
|
122
122
|
existing_node = @neo.execute_query("start node = node:geombbcypher2('bbox:[15.0,15.3,60.0,60.2]') return node")
|
123
|
-
existing_node.
|
124
|
-
existing_node["data"][0][0]["data"]["lat"].
|
125
|
-
existing_node["data"][0][0]["data"]["lon"].
|
123
|
+
expect(existing_node).not_to be_empty
|
124
|
+
expect(existing_node["data"][0][0]["data"]["lat"]).to eq(properties[:lat])
|
125
|
+
expect(existing_node["data"][0][0]["data"]["lon"]).to eq(properties[:lon])
|
126
126
|
end
|
127
127
|
|
128
128
|
end
|
@@ -131,10 +131,10 @@ describe Neography::Rest do
|
|
131
131
|
it "can find a geometry within distance" do
|
132
132
|
properties = {:name => "Max's Restaurant", :lat => 41.8819, :lon => 87.6278}
|
133
133
|
node = @neo.find_geometries_within_distance("restaurants", 87.627, 41.881, 10)
|
134
|
-
node.
|
135
|
-
node.first["data"]["lat"].
|
136
|
-
node.first["data"]["lon"].
|
137
|
-
node.first["data"]["name"].
|
134
|
+
expect(node).not_to be_empty
|
135
|
+
expect(node.first["data"]["lat"]).to eq(properties[:lat])
|
136
|
+
expect(node.first["data"]["lon"]).to eq(properties[:lon])
|
137
|
+
expect(node.first["data"]["name"]).to eq("Max's Restaurant")
|
138
138
|
end
|
139
139
|
|
140
140
|
it "can find a geometry within distance using cypher" do
|
@@ -143,10 +143,10 @@ describe Neography::Rest do
|
|
143
143
|
node = @neo.create_node(properties)
|
144
144
|
added = @neo.add_node_to_index("geowdcypher", "dummy", "dummy", node)
|
145
145
|
existing_node = @neo.execute_query("start n = node:geowdcypher({bbox}) return n", {:bbox => "withinDistance:[60.0,15.0,100.0]"})
|
146
|
-
existing_node.
|
147
|
-
existing_node.
|
148
|
-
existing_node["data"][0][0]["data"]["lat"].
|
149
|
-
existing_node["data"][0][0]["data"]["lon"].
|
146
|
+
expect(existing_node).not_to be_empty
|
147
|
+
expect(existing_node).not_to be_empty
|
148
|
+
expect(existing_node["data"][0][0]["data"]["lat"]).to eq(properties[:lat])
|
149
|
+
expect(existing_node["data"][0][0]["data"]["lon"]).to eq(properties[:lon])
|
150
150
|
end
|
151
151
|
|
152
152
|
it "can find a geometry within distance using cypher 2" do
|
@@ -155,10 +155,10 @@ describe Neography::Rest do
|
|
155
155
|
node = @neo.create_node(properties)
|
156
156
|
added = @neo.add_node_to_spatial_index("geowdcypher2", node)
|
157
157
|
existing_node = @neo.execute_query("start n = node:geowdcypher2({bbox}) return n", {:bbox => "withinDistance:[60.0,15.0,100.0]"})
|
158
|
-
existing_node.
|
159
|
-
existing_node.
|
160
|
-
existing_node["data"][0][0]["data"]["lat"].
|
161
|
-
existing_node["data"][0][0]["data"]["lon"].
|
158
|
+
expect(existing_node).not_to be_empty
|
159
|
+
expect(existing_node).not_to be_empty
|
160
|
+
expect(existing_node["data"][0][0]["data"]["lat"]).to eq(properties[:lat])
|
161
|
+
expect(existing_node["data"][0][0]["data"]["lon"]).to eq(properties[:lon])
|
162
162
|
end
|
163
163
|
|
164
164
|
end
|
@@ -8,26 +8,26 @@ describe Neography::Rest do
|
|
8
8
|
describe "start a transaction" do
|
9
9
|
it "can start a transaction" do
|
10
10
|
tx = @neo.begin_transaction
|
11
|
-
tx.
|
12
|
-
tx["results"].
|
11
|
+
expect(tx).to have_key("transaction")
|
12
|
+
expect(tx["results"]).to be_empty
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can start a transaction with statements" do
|
16
16
|
tx = @neo.begin_transaction("start n=node(0) return n")
|
17
|
-
tx.
|
18
|
-
tx.
|
19
|
-
tx["results"].
|
17
|
+
expect(tx).to have_key("transaction")
|
18
|
+
expect(tx).to have_key("results")
|
19
|
+
expect(tx["results"]).not_to be_empty
|
20
20
|
end
|
21
21
|
|
22
22
|
it "can start a transaction with statements and represent them as a graph" do
|
23
23
|
tx = @neo.begin_transaction(["CREATE ( bike:Bike { weight: 10 } ) CREATE ( frontWheel:Wheel { spokes: 3 } ) CREATE ( backWheel:Wheel { spokes: 32 } ) CREATE p1 = bike -[:HAS { position: 1 } ]-> frontWheel CREATE p2 = bike -[:HAS { position: 2 } ]-> backWheel RETURN bike, p1, p2",
|
24
24
|
["row", "graph", "rest"]])
|
25
|
-
tx.
|
26
|
-
tx.
|
27
|
-
tx["results"].
|
28
|
-
tx["results"].first["data"].first["row"].
|
29
|
-
tx["results"].first["data"].first["graph"].
|
30
|
-
tx["results"].first["data"].first["rest"].
|
25
|
+
expect(tx).to have_key("transaction")
|
26
|
+
expect(tx).to have_key("results")
|
27
|
+
expect(tx["results"]).not_to be_empty
|
28
|
+
expect(tx["results"].first["data"].first["row"]).not_to be_empty
|
29
|
+
expect(tx["results"].first["data"].first["graph"]).not_to be_empty
|
30
|
+
expect(tx["results"].first["data"].first["rest"]).not_to be_empty
|
31
31
|
end
|
32
32
|
|
33
33
|
|
@@ -36,12 +36,12 @@ describe Neography::Rest do
|
|
36
36
|
describe "keep a transaction" do
|
37
37
|
it "can keep a transaction" do
|
38
38
|
tx = @neo.begin_transaction
|
39
|
-
tx.
|
40
|
-
tx["results"].
|
39
|
+
expect(tx).to have_key("transaction")
|
40
|
+
expect(tx["results"]).to be_empty
|
41
41
|
sleep(1)
|
42
42
|
existing_tx = @neo.keep_transaction(tx)
|
43
|
-
existing_tx.
|
44
|
-
existing_tx["transaction"]["expires"].
|
43
|
+
expect(existing_tx).to have_key("transaction")
|
44
|
+
expect(existing_tx["transaction"]["expires"]).to be > tx["transaction"]["expires"]
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -49,42 +49,42 @@ describe Neography::Rest do
|
|
49
49
|
describe "add to a transaction" do
|
50
50
|
it "can add to a transaction" do
|
51
51
|
tx = @neo.begin_transaction
|
52
|
-
tx.
|
53
|
-
tx["results"].
|
52
|
+
expect(tx).to have_key("transaction")
|
53
|
+
expect(tx["results"]).to be_empty
|
54
54
|
existing_tx = @neo.in_transaction(tx, "start n=node(0) return n")
|
55
|
-
existing_tx.
|
56
|
-
existing_tx.
|
57
|
-
existing_tx["results"].
|
55
|
+
expect(existing_tx).to have_key("transaction")
|
56
|
+
expect(existing_tx).to have_key("results")
|
57
|
+
expect(existing_tx["results"]).not_to be_empty
|
58
58
|
end
|
59
59
|
|
60
60
|
it "can add to a transaction with parameters" do
|
61
61
|
tx = @neo.begin_transaction
|
62
|
-
tx.
|
63
|
-
tx["results"].
|
62
|
+
expect(tx).to have_key("transaction")
|
63
|
+
expect(tx["results"]).to be_empty
|
64
64
|
existing_tx = @neo.in_transaction(tx, ["start n=node({id}) return n", {:id => 0}])
|
65
|
-
existing_tx.
|
66
|
-
existing_tx.
|
67
|
-
existing_tx["results"].
|
65
|
+
expect(existing_tx).to have_key("transaction")
|
66
|
+
expect(existing_tx).to have_key("results")
|
67
|
+
expect(existing_tx["results"]).not_to be_empty
|
68
68
|
end
|
69
69
|
|
70
70
|
it "can add to a transaction with representation" do
|
71
71
|
tx = @neo.begin_transaction
|
72
|
-
tx.
|
73
|
-
tx["results"].
|
72
|
+
expect(tx).to have_key("transaction")
|
73
|
+
expect(tx["results"]).to be_empty
|
74
74
|
existing_tx = @neo.in_transaction(tx, ["start n=node(0) return n", [:row,:rest]])
|
75
|
-
existing_tx.
|
76
|
-
existing_tx.
|
77
|
-
existing_tx["results"].
|
75
|
+
expect(existing_tx).to have_key("transaction")
|
76
|
+
expect(existing_tx).to have_key("results")
|
77
|
+
expect(existing_tx["results"]).not_to be_empty
|
78
78
|
end
|
79
79
|
|
80
80
|
it "can add to a transaction with parameters and representation" do
|
81
81
|
tx = @neo.begin_transaction
|
82
|
-
tx.
|
83
|
-
tx["results"].
|
82
|
+
expect(tx).to have_key("transaction")
|
83
|
+
expect(tx["results"]).to be_empty
|
84
84
|
existing_tx = @neo.in_transaction(tx, ["start n=node({id}) return n", {:id => 0}, [:row,:rest]])
|
85
|
-
existing_tx.
|
86
|
-
existing_tx.
|
87
|
-
existing_tx["results"].
|
85
|
+
expect(existing_tx).to have_key("transaction")
|
86
|
+
expect(existing_tx).to have_key("results")
|
87
|
+
expect(existing_tx["results"]).not_to be_empty
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
@@ -92,52 +92,52 @@ describe Neography::Rest do
|
|
92
92
|
describe "commit a transaction" do
|
93
93
|
it "can commit an opened empty transaction" do
|
94
94
|
tx = @neo.begin_transaction
|
95
|
-
tx.
|
96
|
-
tx["results"].
|
95
|
+
expect(tx).to have_key("transaction")
|
96
|
+
expect(tx["results"]).to be_empty
|
97
97
|
existing_tx = @neo.commit_transaction(tx)
|
98
|
-
existing_tx.
|
99
|
-
existing_tx["results"].
|
98
|
+
expect(existing_tx).to have_key("results")
|
99
|
+
expect(existing_tx["results"]).to be_empty
|
100
100
|
end
|
101
101
|
|
102
102
|
it "can commit an opened transaction" do
|
103
103
|
tx = @neo.begin_transaction("start n=node(0) return n")
|
104
|
-
tx.
|
105
|
-
tx["results"].
|
104
|
+
expect(tx).to have_key("transaction")
|
105
|
+
expect(tx["results"]).not_to be_empty
|
106
106
|
existing_tx = @neo.commit_transaction(tx)
|
107
|
-
existing_tx.
|
108
|
-
existing_tx.
|
109
|
-
existing_tx["results"].
|
107
|
+
expect(existing_tx).not_to have_key("transaction")
|
108
|
+
expect(existing_tx).to have_key("results")
|
109
|
+
expect(existing_tx["results"]).to be_empty
|
110
110
|
end
|
111
111
|
|
112
112
|
it "can commit an opened transaction with new statements" do
|
113
113
|
tx = @neo.begin_transaction
|
114
|
-
tx.
|
115
|
-
tx["results"].
|
114
|
+
expect(tx).to have_key("transaction")
|
115
|
+
expect(tx["results"]).to be_empty
|
116
116
|
existing_tx = @neo.commit_transaction(tx, "start n=node(0) return n")
|
117
|
-
existing_tx.
|
118
|
-
existing_tx.
|
119
|
-
existing_tx["results"].
|
117
|
+
expect(existing_tx).not_to have_key("transaction")
|
118
|
+
expect(existing_tx).to have_key("results")
|
119
|
+
expect(existing_tx["results"]).not_to be_empty
|
120
120
|
end
|
121
121
|
|
122
122
|
it "can commit an new transaction right away" do
|
123
123
|
tx = @neo.commit_transaction(["start n=node(0) return n"])
|
124
|
-
tx.
|
125
|
-
tx.
|
126
|
-
tx["results"].
|
124
|
+
expect(tx).not_to have_key("transaction")
|
125
|
+
expect(tx).to have_key("results")
|
126
|
+
expect(tx["results"]).not_to be_empty
|
127
127
|
end
|
128
128
|
|
129
129
|
it "can commit an new transaction right away with parameters" do
|
130
130
|
tx = @neo.commit_transaction(["start n=node({id}) return n", {:id => 0}])
|
131
|
-
tx.
|
132
|
-
tx.
|
133
|
-
tx["results"].
|
131
|
+
expect(tx).not_to have_key("transaction")
|
132
|
+
expect(tx).to have_key("results")
|
133
|
+
expect(tx["results"]).not_to be_empty
|
134
134
|
end
|
135
135
|
|
136
136
|
it "can commit an new transaction right away without parameters" do
|
137
137
|
tx = @neo.commit_transaction("start n=node(0) return n")
|
138
|
-
tx.
|
139
|
-
tx.
|
140
|
-
tx["results"].
|
138
|
+
expect(tx).not_to have_key("transaction")
|
139
|
+
expect(tx).to have_key("results")
|
140
|
+
expect(tx["results"]).not_to be_empty
|
141
141
|
end
|
142
142
|
|
143
143
|
end
|
@@ -145,21 +145,21 @@ describe Neography::Rest do
|
|
145
145
|
describe "rollback a transaction" do
|
146
146
|
it "can rollback an opened empty transaction" do
|
147
147
|
tx = @neo.begin_transaction
|
148
|
-
tx.
|
149
|
-
tx["results"].
|
148
|
+
expect(tx).to have_key("transaction")
|
149
|
+
expect(tx["results"]).to be_empty
|
150
150
|
existing_tx = @neo.rollback_transaction(tx)
|
151
|
-
existing_tx.
|
152
|
-
existing_tx["results"].
|
151
|
+
expect(existing_tx).to have_key("results")
|
152
|
+
expect(existing_tx["results"]).to be_empty
|
153
153
|
end
|
154
154
|
|
155
155
|
it "can rollback an opened transaction" do
|
156
156
|
tx = @neo.begin_transaction("start n=node(0) return n")
|
157
|
-
tx.
|
158
|
-
tx["results"].
|
157
|
+
expect(tx).to have_key("transaction")
|
158
|
+
expect(tx["results"]).not_to be_empty
|
159
159
|
existing_tx = @neo.rollback_transaction(tx)
|
160
|
-
existing_tx.
|
161
|
-
existing_tx.
|
162
|
-
existing_tx["results"].
|
160
|
+
expect(existing_tx).not_to have_key("transaction")
|
161
|
+
expect(existing_tx).to have_key("results")
|
162
|
+
expect(existing_tx["results"]).to be_empty
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|