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
@@ -13,8 +13,8 @@ describe Neography::Rest do
|
|
13
13
|
commands << [:create_node, {"name" => "Max " + x.to_s}]
|
14
14
|
end
|
15
15
|
batch_result = @neo.batch *commands
|
16
|
-
batch_result.first["body"]["data"]["name"].
|
17
|
-
batch_result.last["body"]["data"]["name"].
|
16
|
+
expect(batch_result.first["body"]["data"]["name"]).to eq("Max 0")
|
17
|
+
expect(batch_result.last["body"]["data"]["name"]).to eq("Max 999")
|
18
18
|
end
|
19
19
|
|
20
20
|
it "can send a 5000 item batch" do
|
@@ -23,8 +23,8 @@ describe Neography::Rest do
|
|
23
23
|
commands << [:get_node, 0]
|
24
24
|
end
|
25
25
|
batch_result = @neo.batch *commands
|
26
|
-
batch_result.first["body"]["self"].split('/').last.
|
27
|
-
batch_result.last["body"]["self"].split('/').last.
|
26
|
+
expect(batch_result.first["body"]["self"].split('/').last).to eq("0")
|
27
|
+
expect(batch_result.last["body"]["self"].split('/').last).to eq("0")
|
28
28
|
end
|
29
29
|
|
30
30
|
it "can send a 7000 get item batch" do
|
@@ -33,8 +33,8 @@ describe Neography::Rest do
|
|
33
33
|
commands << [:get_node, 0]
|
34
34
|
end
|
35
35
|
batch_result = @neo.batch *commands
|
36
|
-
batch_result.first["body"]["self"].split('/').last.
|
37
|
-
batch_result.last["body"]["self"].split('/').last.
|
36
|
+
expect(batch_result.first["body"]["self"].split('/').last).to eq("0")
|
37
|
+
expect(batch_result.last["body"]["self"].split('/').last).to eq("0")
|
38
38
|
end
|
39
39
|
|
40
40
|
it "can send a 5000 create item batch" do
|
@@ -43,8 +43,8 @@ describe Neography::Rest do
|
|
43
43
|
commands << [:create_node, {"name" => "Max " + x.to_s}]
|
44
44
|
end
|
45
45
|
batch_result = @neo.batch *commands
|
46
|
-
batch_result.first["body"]["data"]["name"].
|
47
|
-
batch_result.last["body"]["data"]["name"].
|
46
|
+
expect(batch_result.first["body"]["data"]["name"]).to eq("Max 0")
|
47
|
+
expect(batch_result.last["body"]["data"]["name"]).to eq("Max 4999")
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -8,8 +8,8 @@ describe Neography::Rest do
|
|
8
8
|
describe "can create many nodes threaded" do
|
9
9
|
it "can create empty nodes threaded" do
|
10
10
|
new_nodes = @neo.create_nodes_threaded(2)
|
11
|
-
new_nodes.
|
12
|
-
new_nodes.size.
|
11
|
+
expect(new_nodes).not_to be_nil
|
12
|
+
expect(new_nodes.size).to eq(2)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "is faster than non-threaded?" , :slow => true do
|
@@ -19,9 +19,9 @@ describe Neography::Rest do
|
|
19
19
|
x.report("create 1000 nodes threaded") { @threaded2c = @neo.create_nodes_threaded(1000) }
|
20
20
|
end
|
21
21
|
|
22
|
-
@not_threaded[99].
|
23
|
-
@threaded[99].
|
24
|
-
@threaded2c[199].
|
22
|
+
expect(@not_threaded[99]).not_to be_nil
|
23
|
+
expect(@threaded[99]).not_to be_nil
|
24
|
+
expect(@threaded2c[199]).not_to be_nil
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
@@ -29,36 +29,36 @@ describe Neography::Rest do
|
|
29
29
|
describe "can create many nodes" do
|
30
30
|
it "can create empty nodes" do
|
31
31
|
new_nodes = @neo.create_nodes(2)
|
32
|
-
new_nodes.
|
33
|
-
new_nodes.size.
|
32
|
+
expect(new_nodes).not_to be_nil
|
33
|
+
expect(new_nodes.size).to eq(2)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "can create nodes with one property" do
|
37
37
|
new_nodes = @neo.create_nodes([{"name" => "Max"}, {"name" => "Alex"}])
|
38
|
-
new_nodes[0]["data"]["name"].
|
39
|
-
new_nodes[1]["data"]["name"].
|
38
|
+
expect(new_nodes[0]["data"]["name"]).to eq("Max")
|
39
|
+
expect(new_nodes[1]["data"]["name"]).to eq("Alex")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "can create nodes with one property that are different" do
|
43
43
|
new_nodes = @neo.create_nodes([{"name" => "Max"}, {"age" => 24}])
|
44
|
-
new_nodes[0]["data"]["name"].
|
45
|
-
new_nodes[1]["data"]["age"].
|
44
|
+
expect(new_nodes[0]["data"]["name"]).to eq("Max")
|
45
|
+
expect(new_nodes[1]["data"]["age"]).to eq(24)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "can create nodes with more than one property" do
|
49
49
|
new_nodes = @neo.create_nodes([{"age" => 31, "name" => "Max"}, {"age" => 24, "name" => "Alex"}])
|
50
|
-
new_nodes[0]["data"]["name"].
|
51
|
-
new_nodes[0]["data"]["age"].
|
52
|
-
new_nodes[1]["data"]["name"].
|
53
|
-
new_nodes[1]["data"]["age"].
|
50
|
+
expect(new_nodes[0]["data"]["name"]).to eq("Max")
|
51
|
+
expect(new_nodes[0]["data"]["age"]).to eq(31)
|
52
|
+
expect(new_nodes[1]["data"]["name"]).to eq("Alex")
|
53
|
+
expect(new_nodes[1]["data"]["age"]).to eq(24)
|
54
54
|
end
|
55
55
|
|
56
56
|
it "can create nodes with more than one property that are different" do
|
57
57
|
new_nodes = @neo.create_nodes([{"age" => 31, "name" => "Max"}, {"height" => "5-11", "weight" => 215}])
|
58
|
-
new_nodes[0]["data"]["name"].
|
59
|
-
new_nodes[0]["data"]["age"].
|
60
|
-
new_nodes[1]["data"]["height"].
|
61
|
-
new_nodes[1]["data"]["weight"].
|
58
|
+
expect(new_nodes[0]["data"]["name"]).to eq("Max")
|
59
|
+
expect(new_nodes[0]["data"]["age"]).to eq(31)
|
60
|
+
expect(new_nodes[1]["data"]["height"]).to eq("5-11")
|
61
|
+
expect(new_nodes[1]["data"]["weight"]).to eq(215)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "is not super slow?" , :slow => true do
|
@@ -74,8 +74,8 @@ describe Neography::Rest do
|
|
74
74
|
it "can get 2 nodes passed in as an array" do
|
75
75
|
new_nodes = @neo.create_nodes(2)
|
76
76
|
existing_nodes = @neo.get_nodes(new_nodes)
|
77
|
-
existing_nodes.
|
78
|
-
existing_nodes.size.
|
77
|
+
expect(existing_nodes).not_to be_nil
|
78
|
+
expect(existing_nodes.size).to eq(2)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "can get 2 nodes passed in by commas" do
|
@@ -83,8 +83,8 @@ describe Neography::Rest do
|
|
83
83
|
new_node1 = new_nodes[0]["self"].split('/').last
|
84
84
|
new_node2 = new_nodes[1]["self"].split('/').last
|
85
85
|
existing_nodes = @neo.get_nodes(new_node1, new_node2)
|
86
|
-
existing_nodes.
|
87
|
-
existing_nodes.size.
|
86
|
+
expect(existing_nodes).not_to be_nil
|
87
|
+
expect(existing_nodes.size).to eq(2)
|
88
88
|
existing_nodes[0]["self"] == new_node1["self"]
|
89
89
|
existing_nodes[1]["self"] == new_node2["self"]
|
90
90
|
end
|
@@ -10,9 +10,9 @@ describe Neography::Rest do
|
|
10
10
|
label = "User"
|
11
11
|
property = "user_id"
|
12
12
|
uc = @neo.create_unique_constraint(label, property)
|
13
|
-
uc.
|
14
|
-
uc["label"].
|
15
|
-
uc["property_keys"].
|
13
|
+
expect(uc).not_to be_nil
|
14
|
+
expect(uc["label"]).to eq(label)
|
15
|
+
expect(uc["property_keys"]).to eq([property])
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -21,9 +21,9 @@ describe Neography::Rest do
|
|
21
21
|
label = "User"
|
22
22
|
property = "user_id"
|
23
23
|
uc = @neo.get_unique_constraint(label, property)
|
24
|
-
uc.
|
25
|
-
uc.first["label"].
|
26
|
-
uc.first["property_keys"].
|
24
|
+
expect(uc).not_to be_nil
|
25
|
+
expect(uc.first["label"]).to eq(label)
|
26
|
+
expect(uc.first["property_keys"]).to eq([property])
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -32,9 +32,9 @@ describe Neography::Rest do
|
|
32
32
|
label = "User"
|
33
33
|
property = "user_id"
|
34
34
|
uc = @neo.get_uniqueness(label)
|
35
|
-
uc.
|
36
|
-
uc.first["label"].
|
37
|
-
uc.first["property_keys"].
|
35
|
+
expect(uc).not_to be_nil
|
36
|
+
expect(uc.first["label"]).to eq(label)
|
37
|
+
expect(uc.first["property_keys"]).to eq([property])
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,18 +43,18 @@ describe Neography::Rest do
|
|
43
43
|
label = "User"
|
44
44
|
property = "user_id"
|
45
45
|
cs = @neo.get_constraints
|
46
|
-
cs.
|
47
|
-
cs.first["label"].
|
48
|
-
cs.first["property_keys"].
|
46
|
+
expect(cs).not_to be_nil
|
47
|
+
expect(cs.first["label"]).to eq(label)
|
48
|
+
expect(cs.first["property_keys"]).to eq([property])
|
49
49
|
end
|
50
50
|
|
51
51
|
it "can get a list of constraints for a specifc label" do
|
52
52
|
label = "User"
|
53
53
|
property = "user_id"
|
54
54
|
cs = @neo.get_constraints(label)
|
55
|
-
cs.
|
56
|
-
cs.first["label"].
|
57
|
-
cs.first["property_keys"].
|
55
|
+
expect(cs).not_to be_nil
|
56
|
+
expect(cs.first["label"]).to eq(label)
|
57
|
+
expect(cs.first["property_keys"]).to eq([property])
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -63,9 +63,9 @@ describe Neography::Rest do
|
|
63
63
|
label = "User"
|
64
64
|
property = "user_id"
|
65
65
|
uc = @neo.drop_constraint(label, property)
|
66
|
-
uc.
|
66
|
+
expect(uc).to be_nil
|
67
67
|
cs = @neo.get_constraints(label)
|
68
|
-
cs.
|
68
|
+
expect(cs).to be_empty
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -9,14 +9,14 @@ describe Neography::Rest do
|
|
9
9
|
describe "get_nodes", :slow => true do
|
10
10
|
it "can get nodes that exists" do
|
11
11
|
existing_nodes = @neo.get_nodes
|
12
|
-
existing_nodes.
|
12
|
+
expect(existing_nodes).not_to be_nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can get all nodes that exists the ugly way" do
|
16
16
|
new_node = @neo.create_node
|
17
17
|
last_node_id = new_node["self"].split('/').last.to_i
|
18
18
|
existing_nodes = @neo.get_nodes((1..last_node_id).to_a)
|
19
|
-
existing_nodes.
|
19
|
+
expect(existing_nodes).not_to be_nil
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -18,8 +18,8 @@ describe Neography::Rest do
|
|
18
18
|
|
19
19
|
it "gremlin works", :gremlin => true do
|
20
20
|
root_node = @neo.execute_script("g.v(0)")
|
21
|
-
root_node.
|
22
|
-
root_node["self"].split('/').last.
|
21
|
+
expect(root_node).to have_key("self")
|
22
|
+
expect(root_node["self"].split('/').last).to eq("0")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -37,8 +37,8 @@ describe Neography::Rest do
|
|
37
37
|
|
38
38
|
it "gremlin works", :gremlin => true do
|
39
39
|
root_node = @neo.execute_script("g.v(0)")
|
40
|
-
root_node.
|
41
|
-
root_node["self"].split('/').last.
|
40
|
+
expect(root_node).to have_key("self")
|
41
|
+
expect(root_node["self"].split('/').last).to eq("0")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -3,12 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe Neography::Connection do
|
4
4
|
|
5
5
|
it "should not add a content-type header if there's no existing headers" do
|
6
|
-
subject.merge_options({}).keys.
|
6
|
+
expect(subject.merge_options({}).keys).to eq([])
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should add a content type if there's existing headers" do
|
10
|
-
subject.merge_options({:headers => {'Content-Type' => 'foo/bar'}})[:headers].
|
10
|
+
expect(subject.merge_options({:headers => {'Content-Type' => 'foo/bar'}})[:headers]).to eq(
|
11
11
|
{'Content-Type' => "foo/bar", "User-Agent" => "Neography/#{Neography::VERSION}" , "X-Stream"=>true, "max-execution-time"=>6000}
|
12
|
+
)
|
12
13
|
end
|
13
14
|
|
14
15
|
end
|
@@ -11,7 +11,7 @@ describe Neography::Rest do
|
|
11
11
|
key = generate_text(6)
|
12
12
|
value = generate_text
|
13
13
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
14
|
-
@neo.list_indexes.
|
14
|
+
expect(@neo.list_indexes).not_to be_nil
|
15
15
|
end
|
16
16
|
|
17
17
|
it "can get a listing of relationship indexes" do
|
@@ -21,7 +21,7 @@ describe Neography::Rest do
|
|
21
21
|
key = generate_text(6)
|
22
22
|
value = generate_text
|
23
23
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
24
|
-
@neo.list_relationship_indexes.
|
24
|
+
expect(@neo.list_relationship_indexes).not_to be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,47 +29,47 @@ describe Neography::Rest do
|
|
29
29
|
it "can create a node index" do
|
30
30
|
name = generate_text(6)
|
31
31
|
new_index = @neo.create_node_index(name)
|
32
|
-
new_index.
|
33
|
-
new_index["template"].
|
34
|
-
new_index["provider"].
|
35
|
-
new_index["type"].
|
32
|
+
expect(new_index).not_to be_nil
|
33
|
+
expect(new_index["template"]).to eq("#{@neo.configuration}/db/data/index/node/#{name}/{key}/{value}")
|
34
|
+
expect(new_index["provider"]).to eq("lucene")
|
35
|
+
expect(new_index["type"]).to eq("exact")
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can create a node index with options" do
|
39
39
|
name = generate_text(6)
|
40
40
|
new_index = @neo.create_node_index(name, "fulltext","lucene")
|
41
|
-
new_index.
|
42
|
-
new_index["template"].
|
43
|
-
new_index["provider"].
|
44
|
-
new_index["type"].
|
41
|
+
expect(new_index).not_to be_nil
|
42
|
+
expect(new_index["template"]).to eq("#{@neo.configuration}/db/data/index/node/#{name}/{key}/{value}")
|
43
|
+
expect(new_index["provider"]).to eq("lucene")
|
44
|
+
expect(new_index["type"]).to eq("fulltext")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "can create a node index with extra configuration options" do
|
48
48
|
name = generate_text(6)
|
49
49
|
new_index = @neo.create_node_index(name, "fulltext","lucene", extra: 'extra-value')
|
50
|
-
new_index.
|
51
|
-
new_index["template"].
|
52
|
-
new_index["provider"].
|
53
|
-
new_index["extra"].
|
54
|
-
new_index["type"].
|
50
|
+
expect(new_index).not_to be_nil
|
51
|
+
expect(new_index["template"]).to eq("#{@neo.configuration}/db/data/index/node/#{name}/{key}/{value}")
|
52
|
+
expect(new_index["provider"]).to eq("lucene")
|
53
|
+
expect(new_index["extra"]).to eq("extra-value")
|
54
|
+
expect(new_index["type"]).to eq("fulltext")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "can create a relationship index" do
|
58
58
|
name = generate_text(6)
|
59
59
|
new_index = @neo.create_relationship_index(name)
|
60
|
-
new_index.
|
61
|
-
new_index["template"].
|
62
|
-
new_index["provider"].
|
63
|
-
new_index["type"].
|
60
|
+
expect(new_index).not_to be_nil
|
61
|
+
expect(new_index["template"]).to eq("#{@neo.configuration}/db/data/index/relationship/#{name}/{key}/{value}")
|
62
|
+
expect(new_index["provider"]).to eq("lucene")
|
63
|
+
expect(new_index["type"]).to eq("exact")
|
64
64
|
end
|
65
65
|
|
66
66
|
it "can create a relationship index with options" do
|
67
67
|
name = generate_text(6)
|
68
68
|
new_index = @neo.create_relationship_index(name, "fulltext","lucene")
|
69
|
-
new_index.
|
70
|
-
new_index["template"].
|
71
|
-
new_index["provider"].
|
72
|
-
new_index["type"].
|
69
|
+
expect(new_index).not_to be_nil
|
70
|
+
expect(new_index["template"]).to eq("#{@neo.configuration}/db/data/index/relationship/#{name}/{key}/{value}")
|
71
|
+
expect(new_index["provider"]).to eq("lucene")
|
72
|
+
expect(new_index["type"]).to eq("fulltext")
|
73
73
|
end
|
74
74
|
|
75
75
|
|
@@ -82,7 +82,7 @@ describe Neography::Rest do
|
|
82
82
|
value = generate_text
|
83
83
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
84
84
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
85
|
-
new_index.
|
85
|
+
expect(new_index).not_to be_nil
|
86
86
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
87
87
|
end
|
88
88
|
|
@@ -94,7 +94,7 @@ describe Neography::Rest do
|
|
94
94
|
value = generate_text
|
95
95
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
96
96
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
97
|
-
new_index.
|
97
|
+
expect(new_index).not_to be_nil
|
98
98
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
99
99
|
end
|
100
100
|
end
|
@@ -106,10 +106,10 @@ describe Neography::Rest do
|
|
106
106
|
value = generate_text
|
107
107
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
108
108
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
109
|
-
new_index.
|
109
|
+
expect(new_index).not_to be_nil
|
110
110
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
111
111
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
112
|
-
new_index.
|
112
|
+
expect(new_index).to be_nil
|
113
113
|
end
|
114
114
|
|
115
115
|
it "can remove a node from an index without supplying value" do
|
@@ -118,10 +118,10 @@ describe Neography::Rest do
|
|
118
118
|
value = generate_text
|
119
119
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
120
120
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
121
|
-
new_index.
|
121
|
+
expect(new_index).not_to be_nil
|
122
122
|
@neo.remove_node_from_index("test_node_index", key, new_node)
|
123
123
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
124
|
-
new_index.
|
124
|
+
expect(new_index).to be_nil
|
125
125
|
end
|
126
126
|
|
127
127
|
it "can remove a node from an index without supplying key nor value" do
|
@@ -130,10 +130,10 @@ describe Neography::Rest do
|
|
130
130
|
value = generate_text
|
131
131
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
132
132
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
133
|
-
new_index.
|
133
|
+
expect(new_index).not_to be_nil
|
134
134
|
@neo.remove_node_from_index("test_node_index", new_node)
|
135
135
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
136
|
-
new_index.
|
136
|
+
expect(new_index).to be_nil
|
137
137
|
end
|
138
138
|
|
139
139
|
it "can remove a relationship from an index" do
|
@@ -144,10 +144,10 @@ describe Neography::Rest do
|
|
144
144
|
value = generate_text
|
145
145
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
146
146
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
147
|
-
new_index.
|
147
|
+
expect(new_index).not_to be_nil
|
148
148
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
149
149
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
150
|
-
new_index.
|
150
|
+
expect(new_index).to be_nil
|
151
151
|
end
|
152
152
|
|
153
153
|
it "can remove a relationship from an index without supplying value" do
|
@@ -158,10 +158,10 @@ describe Neography::Rest do
|
|
158
158
|
value = generate_text
|
159
159
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
160
160
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
161
|
-
new_index.
|
161
|
+
expect(new_index).not_to be_nil
|
162
162
|
@neo.remove_relationship_from_index("test_relationship_index", key, new_relationship)
|
163
163
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
164
|
-
new_index.
|
164
|
+
expect(new_index).to be_nil
|
165
165
|
end
|
166
166
|
|
167
167
|
it "can remove a relationship from an index without supplying key nor value" do
|
@@ -172,10 +172,10 @@ describe Neography::Rest do
|
|
172
172
|
value = generate_text
|
173
173
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
174
174
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
175
|
-
new_index.
|
175
|
+
expect(new_index).not_to be_nil
|
176
176
|
@neo.remove_relationship_from_index("test_relationship_index", new_relationship)
|
177
177
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
178
|
-
new_index.
|
178
|
+
expect(new_index).to be_nil
|
179
179
|
end
|
180
180
|
|
181
181
|
it "throws an error when there is an empty string in the value when removing a node" do
|
@@ -184,7 +184,7 @@ describe Neography::Rest do
|
|
184
184
|
value = generate_text
|
185
185
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
186
186
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
187
|
-
new_index.
|
187
|
+
expect(new_index).not_to be_nil
|
188
188
|
expect { @neo.remove_node_from_index("test_node_index", key, "", new_node) }.to raise_error Neography::NeographyError
|
189
189
|
end
|
190
190
|
end
|
@@ -196,7 +196,7 @@ describe Neography::Rest do
|
|
196
196
|
value = generate_text
|
197
197
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
198
198
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
199
|
-
new_index.
|
199
|
+
expect(new_index).not_to be_nil
|
200
200
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
201
201
|
end
|
202
202
|
|
@@ -206,7 +206,7 @@ describe Neography::Rest do
|
|
206
206
|
value = generate_text + " " + generate_text
|
207
207
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
208
208
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
209
|
-
new_index.
|
209
|
+
expect(new_index).not_to be_nil
|
210
210
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
211
211
|
end
|
212
212
|
|
@@ -216,7 +216,7 @@ describe Neography::Rest do
|
|
216
216
|
value = generate_text + "/" + generate_text
|
217
217
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
218
218
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
219
|
-
new_index.
|
219
|
+
expect(new_index).not_to be_nil
|
220
220
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
221
221
|
end
|
222
222
|
|
@@ -228,7 +228,7 @@ describe Neography::Rest do
|
|
228
228
|
value = generate_text
|
229
229
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
230
230
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
231
|
-
new_index.
|
231
|
+
expect(new_index).not_to be_nil
|
232
232
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
233
233
|
end
|
234
234
|
end
|
@@ -240,7 +240,7 @@ describe Neography::Rest do
|
|
240
240
|
value = generate_text
|
241
241
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
242
242
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
243
|
-
new_index.first["self"].
|
243
|
+
expect(new_index.first["self"]).to eq(new_node["self"])
|
244
244
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
245
245
|
end
|
246
246
|
|
@@ -250,7 +250,7 @@ describe Neography::Rest do
|
|
250
250
|
value = generate_text
|
251
251
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
252
252
|
new_index = @neo.find_node_index("test_node_index", key, value)
|
253
|
-
new_index.first["self"].
|
253
|
+
expect(new_index.first["self"]).to eq(new_node["self"])
|
254
254
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
255
255
|
end
|
256
256
|
|
@@ -260,7 +260,7 @@ describe Neography::Rest do
|
|
260
260
|
value = generate_text
|
261
261
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
262
262
|
new_index = @neo.find_node_index("test_node_index", "#{key}: #{value}")
|
263
|
-
new_index.first["self"].
|
263
|
+
expect(new_index.first["self"]).to eq(new_node["self"])
|
264
264
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
265
265
|
end
|
266
266
|
|
@@ -270,8 +270,8 @@ describe Neography::Rest do
|
|
270
270
|
value = generate_text + ' ' + generate_text
|
271
271
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
272
272
|
new_index = @neo.find_node_index("test_node_index", key, value)
|
273
|
-
new_index.
|
274
|
-
new_index.first["self"].
|
273
|
+
expect(new_index).not_to be_nil
|
274
|
+
expect(new_index.first["self"]).to eq(new_node["self"])
|
275
275
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
276
276
|
end
|
277
277
|
|
@@ -281,8 +281,8 @@ describe Neography::Rest do
|
|
281
281
|
value = generate_text + '/' + generate_text
|
282
282
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
283
283
|
new_index = @neo.find_node_index("test_node_index", key, value)
|
284
|
-
new_index.
|
285
|
-
new_index.first["self"].
|
284
|
+
expect(new_index).not_to be_nil
|
285
|
+
expect(new_index.first["self"]).to eq(new_node["self"])
|
286
286
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
287
287
|
end
|
288
288
|
|
@@ -294,7 +294,7 @@ describe Neography::Rest do
|
|
294
294
|
value = generate_text
|
295
295
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
296
296
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
297
|
-
new_index.first["self"].
|
297
|
+
expect(new_index.first["self"]).to eq(new_relationship["self"])
|
298
298
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
299
299
|
end
|
300
300
|
|
@@ -306,7 +306,7 @@ describe Neography::Rest do
|
|
306
306
|
value = generate_text + " " + generate_text
|
307
307
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
308
308
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
309
|
-
new_index.first["self"].
|
309
|
+
expect(new_index.first["self"]).to eq(new_relationship["self"])
|
310
310
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
311
311
|
end
|
312
312
|
|
@@ -318,7 +318,7 @@ describe Neography::Rest do
|
|
318
318
|
value = generate_text
|
319
319
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
320
320
|
new_index = @neo.find_relationship_index("test_relationship_index", key, value)
|
321
|
-
new_index.first["self"].
|
321
|
+
expect(new_index.first["self"]).to eq(new_relationship["self"])
|
322
322
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
323
323
|
end
|
324
324
|
|
@@ -330,7 +330,7 @@ describe Neography::Rest do
|
|
330
330
|
value = generate_text
|
331
331
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
332
332
|
new_index = @neo.find_relationship_index("test_relationship_index", "#{key}: #{value}")
|
333
|
-
new_index.first["self"].
|
333
|
+
expect(new_index.first["self"]).to eq(new_relationship["self"])
|
334
334
|
@neo.remove_relationship_from_index("test_relationship_index", key, value, new_relationship)
|
335
335
|
end
|
336
336
|
|
@@ -345,10 +345,10 @@ describe Neography::Rest do
|
|
345
345
|
existing_node1 = @neo.get_node_index("test_node_index", key, value1)
|
346
346
|
existing_node2 = @neo.get_node_index("test_node_index", key, value2)
|
347
347
|
new_relationship = @neo.create_relationship("friends", existing_node1, existing_node2)
|
348
|
-
new_relationship["start"].
|
349
|
-
new_relationship["start"].
|
350
|
-
new_relationship["end"].
|
351
|
-
new_relationship["end"].
|
348
|
+
expect(new_relationship["start"]).not_to be_nil
|
349
|
+
expect(new_relationship["start"]).to eq(new_node1["self"])
|
350
|
+
expect(new_relationship["end"]).not_to be_nil
|
351
|
+
expect(new_relationship["end"]).to eq(new_node2["self"])
|
352
352
|
@neo.remove_node_from_index("test_node_index", new_node1)
|
353
353
|
@neo.remove_node_from_index("test_node_index", new_node2)
|
354
354
|
end
|
@@ -358,72 +358,72 @@ describe Neography::Rest do
|
|
358
358
|
describe "auto indexes" do
|
359
359
|
|
360
360
|
it "can check the status of node auto index" do
|
361
|
-
@neo.get_node_auto_index_status.
|
361
|
+
expect(@neo.get_node_auto_index_status).to satisfy{|status| [true, false].include?(status)}
|
362
362
|
end
|
363
363
|
|
364
364
|
it "can check the status of relationship auto index" do
|
365
|
-
@neo.get_relationship_auto_index_status.
|
365
|
+
expect(@neo.get_relationship_auto_index_status).to satisfy{|status| [true, false].include?(status)}
|
366
366
|
end
|
367
367
|
|
368
368
|
it "can change the node auto index status" do
|
369
369
|
@neo.set_node_auto_index_status(true)
|
370
|
-
@neo.get_node_auto_index_status.
|
370
|
+
expect(@neo.get_node_auto_index_status).to be true
|
371
371
|
end
|
372
372
|
|
373
373
|
it "can change the relationship auto index status" do
|
374
374
|
@neo.set_relationship_auto_index_status(true)
|
375
|
-
@neo.get_relationship_auto_index_status.
|
375
|
+
expect(@neo.get_relationship_auto_index_status).to be true
|
376
376
|
end
|
377
377
|
|
378
378
|
it "can get a list of auto indexed node properties" do
|
379
379
|
@neo.set_node_auto_index_status(true)
|
380
380
|
@neo.create_node_auto_index
|
381
381
|
@neo.add_node_auto_index_property("name")
|
382
|
-
@neo.get_node_auto_index_properties.
|
382
|
+
expect(@neo.get_node_auto_index_properties).to eq(["name"])
|
383
383
|
end
|
384
384
|
|
385
385
|
it "can get a list of auto indexed relationship properties" do
|
386
386
|
@neo.set_relationship_auto_index_status(true)
|
387
387
|
@neo.create_relationship_auto_index
|
388
388
|
@neo.add_relationship_auto_index_property("weight")
|
389
|
-
@neo.get_relationship_auto_index_properties.
|
389
|
+
expect(@neo.get_relationship_auto_index_properties).to eq(["weight"])
|
390
390
|
end
|
391
391
|
|
392
392
|
it "can remove a property from the auto indexed node properties" do
|
393
393
|
@neo.add_node_auto_index_property("name")
|
394
394
|
@neo.add_node_auto_index_property("label")
|
395
|
-
@neo.get_node_auto_index_properties.
|
395
|
+
expect(@neo.get_node_auto_index_properties).to eq(["name", "label"])
|
396
396
|
@neo.remove_node_auto_index_property("label")
|
397
|
-
@neo.get_node_auto_index_properties.
|
397
|
+
expect(@neo.get_node_auto_index_properties).to eq(["name"])
|
398
398
|
end
|
399
399
|
|
400
400
|
it "can remove a property from the auto indexed relationship properties" do
|
401
401
|
@neo.add_relationship_auto_index_property("weight")
|
402
402
|
@neo.add_relationship_auto_index_property("strength")
|
403
|
-
@neo.get_relationship_auto_index_properties.
|
403
|
+
expect(@neo.get_relationship_auto_index_properties).to match_array(["weight", "strength"])
|
404
404
|
@neo.remove_relationship_auto_index_property("strength")
|
405
|
-
@neo.get_relationship_auto_index_properties.
|
405
|
+
expect(@neo.get_relationship_auto_index_properties).to eq(["weight"])
|
406
406
|
end
|
407
407
|
|
408
408
|
it "can get a node from an automatic index" do
|
409
409
|
new_node = @neo.create_node("name" => "Max")
|
410
410
|
existing_nodes = @neo.get_node_auto_index("name", "Max")
|
411
|
-
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).
|
411
|
+
expect(existing_nodes.collect{|n| n["self"]}.include?(new_node["self"])).to be true
|
412
412
|
end
|
413
413
|
|
414
414
|
it "can query a node from an automatic index using key value" do
|
415
415
|
new_node = @neo.create_node("name" => "Max")
|
416
416
|
existing_nodes = @neo.find_node_auto_index("name", "Max")
|
417
|
-
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).
|
417
|
+
expect(existing_nodes.collect{|n| n["self"]}.include?(new_node["self"])).to be true
|
418
418
|
end
|
419
419
|
|
420
420
|
it "can query a node from an automatic index" do
|
421
421
|
new_node = @neo.create_node("name" => "Max")
|
422
422
|
existing_nodes = @neo.find_node_auto_index("name:Max")
|
423
|
-
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).
|
423
|
+
expect(existing_nodes.collect{|n| n["self"]}.include?(new_node["self"])).to be true
|
424
424
|
# check that more complex queries are correctly handled
|
425
425
|
existing_nodes = @neo.find_node_auto_index("name:Max OR name:Max")
|
426
|
-
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).
|
426
|
+
expect(existing_nodes.collect{|n| n["self"]}.include?(new_node["self"])).to be true
|
427
427
|
end
|
428
428
|
|
429
429
|
it "can get a relationship from an automatic index" do
|
@@ -431,7 +431,7 @@ describe Neography::Rest do
|
|
431
431
|
new_node2 = @neo.create_node("name" => "Peter")
|
432
432
|
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
433
433
|
existing_rels = @neo.get_relationship_auto_index("weight", 5)
|
434
|
-
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).
|
434
|
+
expect(existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"])).to be true
|
435
435
|
end
|
436
436
|
|
437
437
|
it "can query a relationship from an automatic index using key value" do
|
@@ -439,7 +439,7 @@ describe Neography::Rest do
|
|
439
439
|
new_node2 = @neo.create_node("name" => "Peter")
|
440
440
|
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
441
441
|
existing_rels = @neo.find_relationship_auto_index("weight", 5)
|
442
|
-
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).
|
442
|
+
expect(existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"])).to be true
|
443
443
|
end
|
444
444
|
|
445
445
|
it "can query a relationship from an automatic index" do
|
@@ -447,7 +447,7 @@ describe Neography::Rest do
|
|
447
447
|
new_node2 = @neo.create_node("name" => "Peter")
|
448
448
|
new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"weight" => 5})
|
449
449
|
existing_rels = @neo.find_relationship_auto_index("weight:5")
|
450
|
-
existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"]).
|
450
|
+
expect(existing_rels.collect{|n| n["self"]}.include?(new_relationship["self"])).to be true
|
451
451
|
end
|
452
452
|
|
453
453
|
end
|
@@ -459,7 +459,7 @@ describe Neography::Rest do
|
|
459
459
|
value = generate_text
|
460
460
|
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
461
461
|
new_index = @neo.get_node_index("test_node_index", key, value)
|
462
|
-
new_index.
|
462
|
+
expect(new_index).not_to be_nil
|
463
463
|
@neo.drop_node_index("test_node_index")
|
464
464
|
expect { @neo.get_node_index("test_node_index", key, value) }.to raise_error Neography::NotFoundException
|
465
465
|
end
|
@@ -472,7 +472,7 @@ describe Neography::Rest do
|
|
472
472
|
value = generate_text
|
473
473
|
@neo.add_relationship_to_index("test_relationship_index", key, value, new_relationship)
|
474
474
|
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
|
475
|
-
new_index.
|
475
|
+
expect(new_index).not_to be_nil
|
476
476
|
@neo.drop_relationship_index("test_relationship_index")
|
477
477
|
expect { @neo.get_relationship_index("test_relationship_index", key, value) }.to raise_error Neography::NotFoundException
|
478
478
|
end
|