neography 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +939 -0
  4. data/Guardfile +14 -0
  5. data/README.md +16 -14
  6. data/lib/neography/connection.rb +1 -0
  7. data/lib/neography/errors.rb +3 -0
  8. data/lib/neography/node.rb +21 -25
  9. data/lib/neography/property.rb +60 -11
  10. data/lib/neography/property_container.rb +5 -6
  11. data/lib/neography/rest/batch.rb +10 -0
  12. data/lib/neography/rest/node_properties.rb +1 -1
  13. data/lib/neography/version.rb +1 -1
  14. data/neography.gemspec +4 -2
  15. data/spec/integration/authorization_spec.rb +4 -4
  16. data/spec/integration/broken_spatial_spec.rb +6 -6
  17. data/spec/integration/index_spec.rb +6 -6
  18. data/spec/integration/neography_spec.rb +1 -1
  19. data/spec/integration/node_encoding_spec.rb +19 -19
  20. data/spec/integration/node_path_spec.rb +36 -36
  21. data/spec/integration/node_relationship_spec.rb +84 -84
  22. data/spec/integration/node_spec.rb +50 -50
  23. data/spec/integration/parsing_spec.rb +2 -2
  24. data/spec/integration/relationship_spec.rb +10 -10
  25. data/spec/integration/rest_batch_no_streaming_spec.rb +6 -6
  26. data/spec/integration/rest_batch_spec.rb +209 -188
  27. data/spec/integration/rest_batch_streaming_spec.rb +8 -8
  28. data/spec/integration/rest_bulk_spec.rb +23 -23
  29. data/spec/integration/rest_constraints_spec.rb +17 -17
  30. data/spec/integration/rest_experimental_spec.rb +2 -2
  31. data/spec/integration/rest_gremlin_fail_spec.rb +4 -4
  32. data/spec/integration/rest_header_spec.rb +3 -2
  33. data/spec/integration/rest_index_spec.rb +76 -76
  34. data/spec/integration/rest_labels_spec.rb +13 -13
  35. data/spec/integration/rest_node_spec.rb +50 -50
  36. data/spec/integration/rest_other_node_relationship_spec.rb +50 -50
  37. data/spec/integration/rest_path_spec.rb +55 -55
  38. data/spec/integration/rest_plugin_spec.rb +59 -59
  39. data/spec/integration/rest_relationship_spec.rb +77 -77
  40. data/spec/integration/rest_relationship_types_spec.rb +2 -2
  41. data/spec/integration/rest_schema_index_spec.rb +6 -6
  42. data/spec/integration/rest_spatial_spec.rb +50 -50
  43. data/spec/integration/rest_transaction_spec.rb +67 -67
  44. data/spec/integration/rest_traverse_spec.rb +40 -40
  45. data/spec/integration/unmanaged_spec.rb +3 -3
  46. data/spec/matchers.rb +2 -2
  47. data/spec/neography_spec.rb +3 -3
  48. data/spec/spec_helper.rb +2 -2
  49. data/spec/unit/config_spec.rb +95 -20
  50. data/spec/unit/connection_spec.rb +40 -40
  51. data/spec/unit/node_spec.rb +12 -12
  52. data/spec/unit/properties_spec.rb +174 -29
  53. data/spec/unit/relationship_spec.rb +16 -16
  54. data/spec/unit/rest/batch_spec.rb +23 -23
  55. data/spec/unit/rest/clean_spec.rb +1 -1
  56. data/spec/unit/rest/constraints_spec.rb +6 -6
  57. data/spec/unit/rest/cypher_spec.rb +1 -1
  58. data/spec/unit/rest/extensions_spec.rb +2 -2
  59. data/spec/unit/rest/gremlin_spec.rb +3 -3
  60. data/spec/unit/rest/helpers_spec.rb +19 -19
  61. data/spec/unit/rest/labels_spec.rb +10 -10
  62. data/spec/unit/rest/node_auto_indexes_spec.rb +13 -13
  63. data/spec/unit/rest/node_indexes_spec.rb +22 -22
  64. data/spec/unit/rest/node_paths_spec.rb +7 -7
  65. data/spec/unit/rest/node_properties_spec.rb +15 -15
  66. data/spec/unit/rest/node_relationships_spec.rb +10 -10
  67. data/spec/unit/rest/node_traversal_spec.rb +1 -1
  68. data/spec/unit/rest/nodes_spec.rb +32 -32
  69. data/spec/unit/rest/relationship_auto_indexes_spec.rb +12 -12
  70. data/spec/unit/rest/relationship_indexes_spec.rb +21 -21
  71. data/spec/unit/rest/relationship_properties_spec.rb +15 -15
  72. data/spec/unit/rest/relationship_types_spec.rb +1 -1
  73. data/spec/unit/rest/relationships_spec.rb +2 -2
  74. data/spec/unit/rest/schema_index_spec.rb +3 -3
  75. data/spec/unit/rest/transactions_spec.rb +4 -4
  76. metadata +32 -3
  77. data/ChangeLog +0 -658
@@ -7,61 +7,61 @@ module Neography
7
7
  subject { Neography::Rest.new }
8
8
 
9
9
  it "gets a node from an auto index" do
10
- subject.connection.should_receive(:get).with("/index/auto/node/some_key/some_value")
10
+ expect(subject.connection).to receive(:get).with("/index/auto/node/some_key/some_value")
11
11
  subject.get_node_auto_index("some_key", "some_value")
12
12
  end
13
13
 
14
14
  it "returns nil if nothing was found in the auto index" do
15
- subject.connection.stub(:get).and_return(nil)
16
- subject.get_node_auto_index("some_key", "some_value").should be_nil
15
+ allow(subject.connection).to receive(:get).and_return(nil)
16
+ expect(subject.get_node_auto_index("some_key", "some_value")).to be_nil
17
17
  end
18
18
 
19
19
  it "finds by key and value if value passed to #find_or_query" do
20
- subject.connection.should_receive(:get).with("/index/auto/node/some_key/some_value")
20
+ expect(subject.connection).to receive(:get).with("/index/auto/node/some_key/some_value")
21
21
  subject.find_node_auto_index("some_key", "some_value")
22
22
  end
23
23
 
24
24
  it "finds by query if no value passed to #find_or_query" do
25
- subject.connection.should_receive(:get).with("/index/auto/node/?query=some_query")
25
+ expect(subject.connection).to receive(:get).with("/index/auto/node/?query=some_query")
26
26
  subject.find_node_auto_index("some_query")
27
27
 
28
28
  query = "some_query AND another_one"
29
- subject.connection.should_receive(:get).with("/index/auto/node/?query=#{URI.encode(query)}")
29
+ expect(subject.connection).to receive(:get).with("/index/auto/node/?query=#{URI.encode(query)}")
30
30
  subject.find_node_auto_index(query)
31
31
  end
32
32
 
33
33
  it "finds by key and value" do
34
- subject.connection.should_receive(:get).with("/index/auto/node/some_key/some_value")
34
+ expect(subject.connection).to receive(:get).with("/index/auto/node/some_key/some_value")
35
35
  subject.find_node_auto_index("some_key", "some_value")
36
36
  end
37
37
 
38
38
  it "finds by query" do
39
- subject.connection.should_receive(:get).with("/index/auto/node/?query=some_query")
39
+ expect(subject.connection).to receive(:get).with("/index/auto/node/?query=some_query")
40
40
  subject.find_node_auto_index("some_query")
41
41
  end
42
42
 
43
43
  it "gets the status" do
44
- subject.connection.should_receive(:get).with("/index/auto/node/status")
44
+ expect(subject.connection).to receive(:get).with("/index/auto/node/status")
45
45
  subject.get_node_auto_index_status
46
46
  end
47
47
 
48
48
  it "sets the status" do
49
- subject.connection.should_receive(:put).with("/index/auto/node/status", hash_match(:body, '"foo"'))
49
+ expect(subject.connection).to receive(:put).with("/index/auto/node/status", hash_match(:body, '"foo"'))
50
50
  subject.set_node_auto_index_status("foo")
51
51
  end
52
52
 
53
53
  it "gets auto index properties" do
54
- subject.connection.should_receive(:get).with("/index/auto/node/properties")
54
+ expect(subject.connection).to receive(:get).with("/index/auto/node/properties")
55
55
  subject.get_node_auto_index_properties
56
56
  end
57
57
 
58
58
  it "adds a property to an auto index" do
59
- subject.connection.should_receive(:post).with("/index/auto/node/properties", hash_match(:body, "foo"))
59
+ expect(subject.connection).to receive(:post).with("/index/auto/node/properties", hash_match(:body, "foo"))
60
60
  subject.add_node_auto_index_property("foo")
61
61
  end
62
62
 
63
63
  it "removes a property from an auto index" do
64
- subject.connection.should_receive(:delete).with("/index/auto/node/properties/foo")
64
+ expect(subject.connection).to receive(:delete).with("/index/auto/node/properties/foo")
65
65
  subject.remove_node_auto_index_property("foo")
66
66
  end
67
67
 
@@ -7,7 +7,7 @@ module Neography
7
7
  subject { Neography::Rest.new }
8
8
 
9
9
  it "lists all indexes" do
10
- subject.connection.should_receive(:get).with("/index/node")
10
+ expect(subject.connection).to receive(:get).with("/index/node")
11
11
  subject.list_node_indexes
12
12
  end
13
13
 
@@ -19,13 +19,13 @@ module Neography
19
19
  },
20
20
  "name" => "some_index"
21
21
  }
22
- subject.connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
22
+ expect(subject.connection).to receive(:post).with("/index/node", json_match(:body, expected_body))
23
23
  subject.create_node_index("some_index", "some_type", "some_provider")
24
24
  end
25
25
 
26
26
  it "returns the post result after creation" do
27
- subject.connection.stub(:post).and_return("foo")
28
- subject.create_node_index("some_index", "some_type", "some_provider").should == "foo"
27
+ allow(subject.connection).to receive(:post).and_return("foo")
28
+ expect(subject.create_node_index("some_index", "some_type", "some_provider")).to eq("foo")
29
29
  end
30
30
 
31
31
  it "creates an auto-index" do
@@ -36,7 +36,7 @@ module Neography
36
36
  },
37
37
  "name" => "node_auto_index"
38
38
  }
39
- subject.connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
39
+ expect(subject.connection).to receive(:post).with("/index/node", json_match(:body, expected_body))
40
40
  subject.create_node_auto_index("some_type", "some_provider")
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ module Neography
46
46
  "key" => "key",
47
47
  "value" => "value"
48
48
  }
49
- subject.connection.should_receive(:post).with("/index/node/some_index?unique", json_match(:body, expected_body))
49
+ expect(subject.connection).to receive(:post).with("/index/node/some_index?unique", json_match(:body, expected_body))
50
50
  subject.create_unique_node("some_index", "key", "value", "properties")
51
51
  end
52
52
 
@@ -56,7 +56,7 @@ module Neography
56
56
  "key" => "key",
57
57
  "value" => "value"
58
58
  }
59
- subject.connection.should_receive(:post).with("/index/node/some_index?uniqueness=get_or_create", json_match(:body, expected_body))
59
+ expect(subject.connection).to receive(:post).with("/index/node/some_index?uniqueness=get_or_create", json_match(:body, expected_body))
60
60
  subject.get_or_create_unique_node("some_index", "key", "value", "properties")
61
61
  end
62
62
 
@@ -66,72 +66,72 @@ module Neography
66
66
  "key" => "key",
67
67
  "value" => "value"
68
68
  }
69
- subject.connection.should_receive(:post).with("/index/node/some_index", json_match(:body, expected_body))
69
+ expect(subject.connection).to receive(:post).with("/index/node/some_index", json_match(:body, expected_body))
70
70
  subject.add_node_to_index("some_index", "key", "value", "42")
71
71
  end
72
72
 
73
73
  it "gets a node from an index" do
74
- subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
74
+ expect(subject.connection).to receive(:get).with("/index/node/some_index/some_key/some_value")
75
75
  subject.get_node_index("some_index", "some_key", "some_value")
76
76
  end
77
77
 
78
78
  it "returns nil if nothing was found in the index" do
79
- subject.connection.stub(:get).and_return(nil)
80
- subject.get_node_index("some_index", "some_key", "some_value").should be_nil
79
+ allow(subject.connection).to receive(:get).and_return(nil)
80
+ expect(subject.get_node_index("some_index", "some_key", "some_value")).to be_nil
81
81
  end
82
82
 
83
83
  it "finds by key and value if both passed to #find" do
84
- subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
84
+ expect(subject.connection).to receive(:get).with("/index/node/some_index/some_key/some_value")
85
85
  subject.find_node_index("some_index", "some_key", "some_value")
86
86
  end
87
87
 
88
88
  it "finds by query if no value passed to #find" do
89
- subject.connection.should_receive(:get).with("/index/node/some_index?query=some_query")
89
+ expect(subject.connection).to receive(:get).with("/index/node/some_index?query=some_query")
90
90
  subject.find_node_index("some_index", "some_query")
91
91
  end
92
92
 
93
93
  it "finds by key and value" do
94
- subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
94
+ expect(subject.connection).to receive(:get).with("/index/node/some_index/some_key/some_value")
95
95
  subject.find_node_index_by_key_value("some_index", "some_key", "some_value")
96
96
  end
97
97
 
98
98
  it "finds by query" do
99
- subject.connection.should_receive(:get).with("/index/node/some_index?query=some_query")
99
+ expect(subject.connection).to receive(:get).with("/index/node/some_index?query=some_query")
100
100
  subject.find_node_index_by_query("some_index", "some_query")
101
101
  end
102
102
 
103
103
  it "removes a node from an index by id for #remove with two arguments" do
104
- subject.connection.should_receive(:delete).with("/index/node/some_index/42")
104
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/42")
105
105
  subject.remove_node_from_index("some_index", "42")
106
106
  end
107
107
 
108
108
  it "removes a node from an index by key for #remove with three arguments" do
109
- subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
109
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/some_key/42")
110
110
  subject.remove_node_from_index("some_index", "some_key", "42")
111
111
  end
112
112
 
113
113
  it "removes a node from an index by key and value for #remove with four arguments" do
114
- subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
114
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/some_key/some_value/42")
115
115
  subject.remove_node_from_index("some_index", "some_key", "some_value", "42")
116
116
  end
117
117
 
118
118
  it "removes a node from an index" do
119
- subject.connection.should_receive(:delete).with("/index/node/some_index/42")
119
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/42")
120
120
  subject.remove_node_index_by_id("some_index", "42")
121
121
  end
122
122
 
123
123
  it "removes a node from an index by key" do
124
- subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
124
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/some_key/42")
125
125
  subject.remove_node_index_by_key("some_index", "42", "some_key")
126
126
  end
127
127
 
128
128
  it "removes a node from an index by key and value" do
129
- subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
129
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index/some_key/some_value/42")
130
130
  subject.remove_node_index_by_value("some_index", "42", "some_key", "some_value")
131
131
  end
132
132
 
133
133
  it "drops an index" do
134
- subject.connection.should_receive(:delete).with("/index/node/some_index")
134
+ expect(subject.connection).to receive(:delete).with("/index/node/some_index")
135
135
  subject.drop_node_index("some_index")
136
136
  end
137
137
 
@@ -14,7 +14,7 @@ module Neography
14
14
  "algorithm" => "shortestPath"
15
15
  }
16
16
 
17
- subject.connection.should_receive(:post).with("/node/42/path", json_match(:body, expected_body))
17
+ expect(subject.connection).to receive(:post).with("/node/42/path", json_match(:body, expected_body))
18
18
 
19
19
  subject.get_path("42", "43", "relationships", 3, "shortestPath")
20
20
  end
@@ -27,7 +27,7 @@ module Neography
27
27
  "algorithm" => "shortestPath"
28
28
  }
29
29
 
30
- subject.connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
30
+ expect(subject.connection).to receive(:post).with("/node/42/paths", json_match(:body, expected_body))
31
31
 
32
32
  subject.get_paths("42", "43", "relationships", 3, "shortestPath")
33
33
  end
@@ -41,7 +41,7 @@ module Neography
41
41
  "algorithm" => "shortestPath"
42
42
  }
43
43
 
44
- subject.connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
44
+ expect(subject.connection).to receive(:post).with("/node/42/paths", json_match(:body, expected_body))
45
45
 
46
46
  subject.get_shortest_weighted_path("42", "43", "relationships", "cost", 3, "shortestPath")
47
47
  end
@@ -50,24 +50,24 @@ module Neography
50
50
 
51
51
  [ :shortest, "shortest", :shortestPath, "shortestPath", :short, "short" ].each do |algorithm|
52
52
  it "parses shortestPath" do
53
- subject.send(:get_algorithm, algorithm).should == "shortestPath"
53
+ expect(subject.send(:get_algorithm, algorithm)).to eq("shortestPath")
54
54
  end
55
55
  end
56
56
 
57
57
  [ :allSimplePaths, "allSimplePaths", :simple, "simple" ].each do |algorithm|
58
58
  it "parses allSimplePaths" do
59
- subject.send(:get_algorithm, algorithm).should == "allSimplePaths"
59
+ expect(subject.send(:get_algorithm, algorithm)).to eq("allSimplePaths")
60
60
  end
61
61
  end
62
62
 
63
63
  [ :dijkstra, "dijkstra" ].each do |algorithm|
64
64
  it "parses dijkstra" do
65
- subject.send(:get_algorithm, algorithm).should == "dijkstra"
65
+ expect(subject.send(:get_algorithm, algorithm)).to eq("dijkstra")
66
66
  end
67
67
  end
68
68
 
69
69
  it "parses allPaths by default" do
70
- subject.send(:get_algorithm, "foo").should == "allPaths"
70
+ expect(subject.send(:get_algorithm, "foo")).to eq("allPaths")
71
71
  end
72
72
 
73
73
  end
@@ -15,8 +15,8 @@ module Neography
15
15
  :body => '"qux"',
16
16
  :headers => json_content_type
17
17
  }
18
- subject.connection.should_receive(:put).with("/node/42/properties/foo", options1)
19
- subject.connection.should_receive(:put).with("/node/42/properties/baz", options2)
18
+ expect(subject.connection).to receive(:put).with("/node/42/properties/foo", options1)
19
+ expect(subject.connection).to receive(:put).with("/node/42/properties/baz", options2)
20
20
  subject.set_node_properties("42", {:foo => "bar", :baz => "qux"})
21
21
  end
22
22
 
@@ -25,36 +25,36 @@ module Neography
25
25
  :body => '{"foo":"bar"}',
26
26
  :headers => json_content_type
27
27
  }
28
- subject.connection.should_receive(:put).with("/node/42/properties", options)
28
+ expect(subject.connection).to receive(:put).with("/node/42/properties", options)
29
29
  subject.reset_node_properties("42", {:foo => "bar"})
30
30
  end
31
31
 
32
32
  context "getting properties" do
33
33
 
34
34
  it "gets all properties" do
35
- subject.connection.should_receive(:get).with("/node/42/properties")
35
+ expect(subject.connection).to receive(:get).with("/node/42/properties")
36
36
  subject.get_node_properties("42")
37
37
  end
38
38
 
39
39
  it "gets multiple properties" do
40
- subject.connection.should_receive(:get).with("/node/42/properties/foo")
41
- subject.connection.should_receive(:get).with("/node/42/properties/bar")
40
+ expect(subject.connection).to receive(:get).with("/node/42/properties/foo")
41
+ expect(subject.connection).to receive(:get).with("/node/42/properties/bar")
42
42
  subject.get_node_properties("42", "foo", "bar")
43
43
  end
44
44
 
45
45
  it "returns multiple properties as a hash" do
46
- subject.connection.stub(:get).and_return("baz", "qux")
47
- subject.get_node_properties("42", "foo", "bar").should == { "foo" => "baz", "bar" => "qux" }
46
+ allow(subject.connection).to receive(:get).and_return("baz", "qux")
47
+ expect(subject.get_node_properties("42", "foo", "bar")).to eq({ "foo" => "baz", "bar" => "qux" })
48
48
  end
49
49
 
50
50
  it "returns nil if no properties were found" do
51
- subject.connection.stub(:get).and_return(nil, nil)
52
- subject.get_node_properties("42", "foo", "bar").should be_nil
51
+ allow(subject.connection).to receive(:get).and_return(nil, nil)
52
+ expect(subject.get_node_properties("42", "foo", "bar")).to be_nil
53
53
  end
54
54
 
55
55
  it "returns hash without nil return values" do
56
- subject.connection.stub(:get).and_return("baz", nil)
57
- subject.get_node_properties("42", "foo", "bar").should == { "foo" => "baz" }
56
+ allow(subject.connection).to receive(:get).and_return("baz", nil)
57
+ expect(subject.get_node_properties("42", "foo", "bar")).to eq({ "foo" => "baz" })
58
58
  end
59
59
 
60
60
  end
@@ -62,13 +62,13 @@ module Neography
62
62
  context "removing properties" do
63
63
 
64
64
  it "removes all properties" do
65
- subject.connection.should_receive(:delete).with("/node/42/properties")
65
+ expect(subject.connection).to receive(:delete).with("/node/42/properties")
66
66
  subject.remove_node_properties("42")
67
67
  end
68
68
 
69
69
  it "removes multiple properties" do
70
- subject.connection.should_receive(:delete).with("/node/42/properties/foo")
71
- subject.connection.should_receive(:delete).with("/node/42/properties/bar")
70
+ expect(subject.connection).to receive(:delete).with("/node/42/properties/foo")
71
+ expect(subject.connection).to receive(:delete).with("/node/42/properties/bar")
72
72
  subject.remove_node_properties("42", "foo", "bar")
73
73
  end
74
74
 
@@ -11,44 +11,44 @@ module Neography
11
11
  "to" => "http://localhost:7474/node/43",
12
12
  "data" => {"foo"=>"bar","baz"=>"qux"}
13
13
  }
14
- subject.connection.should_receive(:post).with("/node/42/relationships", json_match(:body, body_hash))
14
+ expect(subject.connection).to receive(:post).with("/node/42/relationships", json_match(:body, body_hash))
15
15
 
16
16
  subject.create_relationship("some_type", "42", "43", {:foo => "bar", :baz => "qux"})
17
17
  end
18
18
 
19
19
  it "returns the post results" do
20
- subject.connection.stub(:post).and_return("foo")
20
+ allow(subject.connection).to receive(:post).and_return("foo")
21
21
 
22
- subject.create_relationship("some_type", "42", "43", {}).should == "foo"
22
+ expect(subject.create_relationship("some_type", "42", "43", {})).to eq("foo")
23
23
  end
24
24
 
25
25
  it "gets relationships" do
26
- subject.connection.should_receive(:get).with("/node/42/relationships/all")
26
+ expect(subject.connection).to receive(:get).with("/node/42/relationships/all")
27
27
  subject.get_node_relationships("42")
28
28
  end
29
29
 
30
30
  it "gets relationships with direction" do
31
- subject.connection.should_receive(:get).with("/node/42/relationships/in")
31
+ expect(subject.connection).to receive(:get).with("/node/42/relationships/in")
32
32
  subject.get_node_relationships("42", :in)
33
33
  end
34
34
 
35
35
  it "gets relationships with direction and type" do
36
- subject.connection.should_receive(:get).with("/node/42/relationships/in/foo")
36
+ expect(subject.connection).to receive(:get).with("/node/42/relationships/in/foo")
37
37
  subject.get_node_relationships("42", :in, "foo")
38
38
  end
39
39
 
40
40
  it "gets relationships with direction and types" do
41
- subject.connection.should_receive(:get).with("/node/42/relationships/in/foo%26bar")
41
+ expect(subject.connection).to receive(:get).with("/node/42/relationships/in/foo%26bar")
42
42
  subject.get_node_relationships("42", :in, ["foo", "bar"])
43
43
  end
44
44
 
45
45
  it "returns empty array if no relationships were found" do
46
- subject.connection.stub(:get).and_return([])
47
- subject.get_node_relationships("42", :in).should be_empty
46
+ allow(subject.connection).to receive(:get).and_return([])
47
+ expect(subject.get_node_relationships("42", :in)).to be_empty
48
48
  end
49
49
 
50
50
  it "returns empty array if no relationships were found by type" do
51
- subject.connection.stub(:get).and_return([])
51
+ allow(subject.connection).to receive(:get).and_return([])
52
52
  subject.get_node_relationships("42", :in, "foo")
53
53
  end
54
54
 
@@ -25,7 +25,7 @@ module Neography
25
25
  "max_depth" => 4
26
26
  }
27
27
 
28
- subject.connection.should_receive(:post).with("/node/42/traverse/relationship", json_match(:body, expected_body))
28
+ expect(subject.connection).to receive(:post).with("/node/42/traverse/relationship", json_match(:body, expected_body))
29
29
 
30
30
  subject.traverse("42", :relationship, description)
31
31
  end
@@ -8,30 +8,30 @@ module Neography
8
8
 
9
9
  context "get nodes" do
10
10
  it "gets single nodes" do
11
- subject.connection.should_receive(:get).with("/node/42")
11
+ expect(subject.connection).to receive(:get).with("/node/42")
12
12
  subject.get_node("42")
13
13
  end
14
14
 
15
15
  it "gets multiple nodes" do
16
- subject.connection.should_receive(:get).with("/node/42")
17
- subject.connection.should_receive(:get).with("/node/43")
16
+ expect(subject.connection).to receive(:get).with("/node/42")
17
+ expect(subject.connection).to receive(:get).with("/node/43")
18
18
  subject.get_nodes("42", "43")
19
19
  end
20
20
 
21
21
  it "returns multiple nodes in an array" do
22
- subject.connection.stub(:get).and_return("foo", "bar")
23
- subject.get_nodes("42", "43").should == [ "foo", "bar" ]
22
+ allow(subject.connection).to receive(:get).and_return("foo", "bar")
23
+ expect(subject.get_nodes("42", "43")).to eq([ "foo", "bar" ])
24
24
  end
25
25
 
26
26
  it "gets the root node" do
27
- subject.connection.stub(:get).with("/").and_return({ "reference_node" => "42" })
28
- subject.connection.should_receive(:get).with("/node/42")
27
+ allow(subject.connection).to receive(:get).with("/").and_return({ "reference_node" => "42" })
28
+ expect(subject.connection).to receive(:get).with("/node/42")
29
29
  subject.get_root
30
30
  end
31
31
 
32
32
  it "returns the root node" do
33
- subject.connection.stub(:get).and_return({ "reference_node" => "42" }, "foo")
34
- subject.get_root.should == "foo"
33
+ allow(subject.connection).to receive(:get).and_return({ "reference_node" => "42" }, "foo")
34
+ expect(subject.get_root).to eq("foo")
35
35
  end
36
36
  end
37
37
 
@@ -42,13 +42,13 @@ module Neography
42
42
  :body => '{"foo":"bar","baz":"qux"}',
43
43
  :headers => json_content_type
44
44
  }
45
- subject.connection.should_receive(:post).with("/node", options)
45
+ expect(subject.connection).to receive(:post).with("/node", options)
46
46
  subject.create_node_with_attributes({:foo => "bar", :baz => "qux"})
47
47
  end
48
48
 
49
49
  it "returns the created node" do
50
- subject.connection.stub(:post).and_return("foo")
51
- subject.create_node_with_attributes({}).should == "foo"
50
+ allow(subject.connection).to receive(:post).and_return("foo")
51
+ expect(subject.create_node_with_attributes({})).to eq("foo")
52
52
  end
53
53
 
54
54
  it "creates with attributes using #create method" do
@@ -56,22 +56,22 @@ module Neography
56
56
  :body => '{"foo":"bar","baz":"qux"}',
57
57
  :headers => json_content_type
58
58
  }
59
- subject.connection.should_receive(:post).with("/node", options)
59
+ expect(subject.connection).to receive(:post).with("/node", options)
60
60
  subject.create_node({:foo => "bar", :baz => "qux"})
61
61
  end
62
62
 
63
63
  it "creates empty nodes" do
64
- subject.connection.should_receive(:post).with("/node")
64
+ expect(subject.connection).to receive(:post).with("/node")
65
65
  subject.create_empty_node
66
66
  end
67
67
 
68
68
  it "returns an empty node" do
69
- subject.connection.stub(:post).and_return("foo")
70
- subject.create_empty_node.should == "foo"
69
+ allow(subject.connection).to receive(:post).and_return("foo")
70
+ expect(subject.create_empty_node).to eq("foo")
71
71
  end
72
72
 
73
73
  it "creates empty nodes using #create method" do
74
- subject.connection.should_receive(:post).with("/node")
74
+ expect(subject.connection).to receive(:post).with("/node")
75
75
  subject.create_node
76
76
  end
77
77
 
@@ -80,7 +80,7 @@ module Neography
80
80
  context "delete nodes" do
81
81
 
82
82
  it "deletes a node" do
83
- subject.connection.should_receive(:delete).with("/node/42")
83
+ expect(subject.connection).to receive(:delete).with("/node/42")
84
84
  subject.delete_node("42")
85
85
  end
86
86
 
@@ -97,8 +97,8 @@ module Neography
97
97
  :body => '{"foo2":"bar2","baz2":"qux2"}',
98
98
  :headers => json_content_type
99
99
  }
100
- subject.connection.should_receive(:post).with("/node", options1)
101
- subject.connection.should_receive(:post).with("/node", options2)
100
+ expect(subject.connection).to receive(:post).with("/node", options1)
101
+ expect(subject.connection).to receive(:post).with("/node", options2)
102
102
 
103
103
  subject.create_nodes([
104
104
  {:foo1 => "bar1", :baz1 => "qux1"},
@@ -107,8 +107,8 @@ module Neography
107
107
  end
108
108
 
109
109
  it "returns multiple nodes with attributes in an array" do
110
- subject.connection.stub(:post).and_return("foo", "bar")
111
- subject.create_nodes([{},{}]).should == ["foo", "bar"]
110
+ allow(subject.connection).to receive(:post).and_return("foo", "bar")
111
+ expect(subject.create_nodes([{},{}])).to eq(["foo", "bar"])
112
112
  end
113
113
 
114
114
  # exotic?
@@ -117,8 +117,8 @@ module Neography
117
117
  :body => '{"foo1":"bar1","baz1":"qux1"}',
118
118
  :headers => json_content_type
119
119
  }
120
- subject.connection.should_receive(:post).with("/node", options1)
121
- subject.connection.should_receive(:post).with("/node")
120
+ expect(subject.connection).to receive(:post).with("/node", options1)
121
+ expect(subject.connection).to receive(:post).with("/node")
122
122
 
123
123
  subject.create_nodes([
124
124
  {:foo1 => "bar1", :baz1 => "qux1"},
@@ -127,13 +127,13 @@ module Neography
127
127
  end
128
128
 
129
129
  it "creates multiple empty nodes" do
130
- subject.connection.should_receive(:post).with("/node").twice
130
+ expect(subject.connection).to receive(:post).with("/node").twice
131
131
  subject.create_nodes(2)
132
132
  end
133
133
 
134
134
  it "returns multiple empty nodes in an array" do
135
- subject.connection.stub(:post).and_return("foo", "bar")
136
- subject.create_nodes(2).should == ["foo", "bar"]
135
+ allow(subject.connection).to receive(:post).and_return("foo", "bar")
136
+ expect(subject.create_nodes(2)).to eq(["foo", "bar"])
137
137
  end
138
138
 
139
139
  end
@@ -151,8 +151,8 @@ module Neography
151
151
  :body => '{"foo2":"bar2","baz2":"qux2"}',
152
152
  :headers => json_content_type
153
153
  }
154
- subject.connection.should_receive(:post).with("/node", options1)
155
- subject.connection.should_receive(:post).with("/node", options2)
154
+ expect(subject.connection).to receive(:post).with("/node", options1)
155
+ expect(subject.connection).to receive(:post).with("/node", options2)
156
156
 
157
157
  subject.create_nodes_threaded([
158
158
  {:foo1 => "bar1", :baz1 => "qux1"},
@@ -166,8 +166,8 @@ module Neography
166
166
  :body => '{"foo1":"bar1","baz1":"qux1"}',
167
167
  :headers => json_content_type
168
168
  }
169
- subject.connection.should_receive(:post).with("/node", options1)
170
- subject.connection.should_receive(:post).with("/node")
169
+ expect(subject.connection).to receive(:post).with("/node", options1)
170
+ expect(subject.connection).to receive(:post).with("/node")
171
171
 
172
172
  subject.create_nodes_threaded([
173
173
  {:foo1 => "bar1", :baz1 => "qux1"},
@@ -176,7 +176,7 @@ module Neography
176
176
  end
177
177
 
178
178
  it "creates multiple empty nodes" do
179
- subject.connection.should_receive(:post).with("/node").twice
179
+ expect(subject.connection).to receive(:post).with("/node").twice
180
180
  subject.create_nodes_threaded(2)
181
181
  end
182
182