neography 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +939 -0
  4. data/Guardfile +14 -0
  5. data/README.md +16 -14
  6. data/lib/neography/connection.rb +1 -0
  7. data/lib/neography/errors.rb +3 -0
  8. data/lib/neography/node.rb +21 -25
  9. data/lib/neography/property.rb +60 -11
  10. data/lib/neography/property_container.rb +5 -6
  11. data/lib/neography/rest/batch.rb +10 -0
  12. data/lib/neography/rest/node_properties.rb +1 -1
  13. data/lib/neography/version.rb +1 -1
  14. data/neography.gemspec +4 -2
  15. data/spec/integration/authorization_spec.rb +4 -4
  16. data/spec/integration/broken_spatial_spec.rb +6 -6
  17. data/spec/integration/index_spec.rb +6 -6
  18. data/spec/integration/neography_spec.rb +1 -1
  19. data/spec/integration/node_encoding_spec.rb +19 -19
  20. data/spec/integration/node_path_spec.rb +36 -36
  21. data/spec/integration/node_relationship_spec.rb +84 -84
  22. data/spec/integration/node_spec.rb +50 -50
  23. data/spec/integration/parsing_spec.rb +2 -2
  24. data/spec/integration/relationship_spec.rb +10 -10
  25. data/spec/integration/rest_batch_no_streaming_spec.rb +6 -6
  26. data/spec/integration/rest_batch_spec.rb +209 -188
  27. data/spec/integration/rest_batch_streaming_spec.rb +8 -8
  28. data/spec/integration/rest_bulk_spec.rb +23 -23
  29. data/spec/integration/rest_constraints_spec.rb +17 -17
  30. data/spec/integration/rest_experimental_spec.rb +2 -2
  31. data/spec/integration/rest_gremlin_fail_spec.rb +4 -4
  32. data/spec/integration/rest_header_spec.rb +3 -2
  33. data/spec/integration/rest_index_spec.rb +76 -76
  34. data/spec/integration/rest_labels_spec.rb +13 -13
  35. data/spec/integration/rest_node_spec.rb +50 -50
  36. data/spec/integration/rest_other_node_relationship_spec.rb +50 -50
  37. data/spec/integration/rest_path_spec.rb +55 -55
  38. data/spec/integration/rest_plugin_spec.rb +59 -59
  39. data/spec/integration/rest_relationship_spec.rb +77 -77
  40. data/spec/integration/rest_relationship_types_spec.rb +2 -2
  41. data/spec/integration/rest_schema_index_spec.rb +6 -6
  42. data/spec/integration/rest_spatial_spec.rb +50 -50
  43. data/spec/integration/rest_transaction_spec.rb +67 -67
  44. data/spec/integration/rest_traverse_spec.rb +40 -40
  45. data/spec/integration/unmanaged_spec.rb +3 -3
  46. data/spec/matchers.rb +2 -2
  47. data/spec/neography_spec.rb +3 -3
  48. data/spec/spec_helper.rb +2 -2
  49. data/spec/unit/config_spec.rb +95 -20
  50. data/spec/unit/connection_spec.rb +40 -40
  51. data/spec/unit/node_spec.rb +12 -12
  52. data/spec/unit/properties_spec.rb +174 -29
  53. data/spec/unit/relationship_spec.rb +16 -16
  54. data/spec/unit/rest/batch_spec.rb +23 -23
  55. data/spec/unit/rest/clean_spec.rb +1 -1
  56. data/spec/unit/rest/constraints_spec.rb +6 -6
  57. data/spec/unit/rest/cypher_spec.rb +1 -1
  58. data/spec/unit/rest/extensions_spec.rb +2 -2
  59. data/spec/unit/rest/gremlin_spec.rb +3 -3
  60. data/spec/unit/rest/helpers_spec.rb +19 -19
  61. data/spec/unit/rest/labels_spec.rb +10 -10
  62. data/spec/unit/rest/node_auto_indexes_spec.rb +13 -13
  63. data/spec/unit/rest/node_indexes_spec.rb +22 -22
  64. data/spec/unit/rest/node_paths_spec.rb +7 -7
  65. data/spec/unit/rest/node_properties_spec.rb +15 -15
  66. data/spec/unit/rest/node_relationships_spec.rb +10 -10
  67. data/spec/unit/rest/node_traversal_spec.rb +1 -1
  68. data/spec/unit/rest/nodes_spec.rb +32 -32
  69. data/spec/unit/rest/relationship_auto_indexes_spec.rb +12 -12
  70. data/spec/unit/rest/relationship_indexes_spec.rb +21 -21
  71. data/spec/unit/rest/relationship_properties_spec.rb +15 -15
  72. data/spec/unit/rest/relationship_types_spec.rb +1 -1
  73. data/spec/unit/rest/relationships_spec.rb +2 -2
  74. data/spec/unit/rest/schema_index_spec.rb +3 -3
  75. data/spec/unit/rest/transactions_spec.rb +4 -4
  76. metadata +32 -3
  77. data/ChangeLog +0 -658
@@ -18,11 +18,11 @@ describe Neography::Rest do
18
18
  @neo.create_relationship("friends", @new_node4, @new_node5)
19
19
  @neo.create_relationship("friends", @new_node3, @new_node5)
20
20
  nodes = @neo.traverse(@new_node1, "nodes", {"relationships" => {"type"=> "friends", "direction" => "out"}, "depth" => 4} )
21
- nodes.should_not be_nil
22
- nodes[0]["self"].should == @new_node2["self"]
23
- nodes[1]["self"].should == @new_node3["self"]
24
- nodes[2]["self"].should == @new_node4["self"]
25
- nodes[3]["self"].should == @new_node5["self"]
21
+ expect(nodes).not_to be_nil
22
+ expect(nodes[0]["self"]).to eq(@new_node2["self"])
23
+ expect(nodes[1]["self"]).to eq(@new_node3["self"])
24
+ expect(nodes[2]["self"]).to eq(@new_node4["self"])
25
+ expect(nodes[3]["self"]).to eq(@new_node5["self"])
26
26
  end
27
27
  it "can traverse the graph and return relationships" do
28
28
  new_relationship1= @neo.create_relationship("friends", @new_node1, @new_node2)
@@ -32,12 +32,12 @@ describe Neography::Rest do
32
32
  new_relationship5= @neo.create_relationship("friends", @new_node3, @new_node5)
33
33
 
34
34
  relationships = @neo.traverse(@new_node1, "relationships", {"relationships" => {"type"=> "friends", "direction" => "out"}, "depth" => 4} )
35
- relationships.should_not be_nil
35
+ expect(relationships).not_to be_nil
36
36
 
37
- relationships[0]["self"].should == new_relationship1["self"]
38
- relationships[1]["self"].should == new_relationship2["self"]
39
- relationships[2]["self"].should == new_relationship3["self"]
40
- relationships[3]["self"].should == new_relationship4["self"]
37
+ expect(relationships[0]["self"]).to eq(new_relationship1["self"])
38
+ expect(relationships[1]["self"]).to eq(new_relationship2["self"])
39
+ expect(relationships[2]["self"]).to eq(new_relationship3["self"])
40
+ expect(relationships[3]["self"]).to eq(new_relationship4["self"])
41
41
  end
42
42
 
43
43
  it "can traverse the graph and return paths" do
@@ -48,12 +48,12 @@ describe Neography::Rest do
48
48
  new_relationship5= @neo.create_relationship("friends", @new_node3, @new_node5)
49
49
 
50
50
  paths = @neo.traverse(@new_node1, "paths", {"relationships" => {"type"=> "friends", "direction" => "out"}, "depth" => 4} )
51
- paths.should_not be_nil
51
+ expect(paths).not_to be_nil
52
52
 
53
- paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
54
- paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
55
- paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]]
56
- paths[3]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"], @new_node5["self"]]
53
+ expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
54
+ expect(paths[1]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"]])
55
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
56
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"], @new_node5["self"]])
57
57
  end
58
58
 
59
59
  it "can traverse the graph up to a certain depth" do
@@ -64,12 +64,12 @@ describe Neography::Rest do
64
64
  new_relationship5= @neo.create_relationship("friends", @new_node3, @new_node5)
65
65
 
66
66
  paths = @neo.traverse(@new_node1, "paths", {"relationships" => {"type"=> "friends", "direction" => "out"}, "depth" => 3} )
67
- paths.should_not be_nil
67
+ expect(paths).not_to be_nil
68
68
 
69
- paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
70
- paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
71
- paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]]
72
- paths[3]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]]
69
+ expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
70
+ expect(paths[1]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"]])
71
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
72
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]])
73
73
  end
74
74
 
75
75
  it "can traverse the graph in a certain order" do
@@ -80,12 +80,12 @@ describe Neography::Rest do
80
80
  new_relationship5= @neo.create_relationship("friends", @new_node3, @new_node5)
81
81
 
82
82
  paths = @neo.traverse(@new_node1, "paths", {"order" => "breadth first", "relationships" => {"type"=> "friends", "direction" => "out"}, "depth" => 4} )
83
- paths.should_not be_nil
83
+ expect(paths).not_to be_nil
84
84
 
85
- paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
86
- paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
87
- paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]]
88
- paths[3]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]]
85
+ expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
86
+ expect(paths[1]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"]])
87
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
88
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]])
89
89
  end
90
90
 
91
91
  it "can traverse the graph with a specific uniqueness" do
@@ -98,12 +98,12 @@ describe Neography::Rest do
98
98
  new_relationship5= @neo.create_relationship("friends", @new_node3, @new_node5)
99
99
 
100
100
  paths = @neo.traverse(@new_node1, "paths", {"order" => "breadth first", "uniqueness" => "node global", "relationships" => [{"type"=> "roommates", "direction" => "all"},{"type"=> "friends", "direction" => "out"}], "depth" => 4} )
101
- paths.should_not be_nil
101
+ expect(paths).not_to be_nil
102
102
 
103
- paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
104
- paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node5["self"]]
105
- paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
106
- paths[3]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]]
103
+ expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
104
+ expect(paths[1]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node5["self"]])
105
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"]])
106
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
107
107
  end
108
108
 
109
109
  it "can traverse the graph with a prune evaluator" do
@@ -119,10 +119,10 @@ describe Neography::Rest do
119
119
  "depth" => 3,
120
120
  "prune evaluator" => {"language" => "javascript", "body" => "position.endNode().getProperty('age') < 21;"
121
121
  }} )
122
- paths.should_not be_nil
123
- paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
124
- paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
125
- paths[2].should be_nil
122
+ expect(paths).not_to be_nil
123
+ expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
124
+ expect(paths[1]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"]])
125
+ expect(paths[2]).to be_nil
126
126
  end
127
127
 
128
128
  it "can traverse the graph with a return filter" do
@@ -134,12 +134,12 @@ describe Neography::Rest do
134
134
  nodes = @neo.traverse(@new_node1, "node", {"relationships" => {"type"=> "friends", "direction" => "out"},
135
135
  "return filter" => {"language" => "builtin", "name" => "all"},
136
136
  "depth" => 4} )
137
- nodes.should_not be_nil
138
- nodes[0]["self"].should == @new_node1["self"]
139
- nodes[1]["self"].should == @new_node2["self"]
140
- nodes[2]["self"].should == @new_node3["self"]
141
- nodes[3]["self"].should == @new_node4["self"]
142
- nodes[4]["self"].should == @new_node5["self"]
137
+ expect(nodes).not_to be_nil
138
+ expect(nodes[0]["self"]).to eq(@new_node1["self"])
139
+ expect(nodes[1]["self"]).to eq(@new_node2["self"])
140
+ expect(nodes[2]["self"]).to eq(@new_node3["self"])
141
+ expect(nodes[3]["self"]).to eq(@new_node4["self"])
142
+ expect(nodes[4]["self"]).to eq(@new_node5["self"])
143
143
  end
144
144
 
145
145
 
@@ -8,18 +8,18 @@ describe Neography::Rest do
8
8
  describe "call unmanaged extensions", :unmanaged_extensions => true do
9
9
  it "can call a get based unmanaged extension" do
10
10
  results = @neo.get_extension('/example/service/queries/fofof/13343')
11
- results.should_not be_null
11
+ expect(results).not_to be_null
12
12
  end
13
13
 
14
14
  it "can call a POST based unmanaged extension" do
15
15
  results = @neo.post_extention('/movie/recommend', {"title" => "Rambo"})
16
- results.should_not be_null
16
+ expect(results).not_to be_null
17
17
  end
18
18
 
19
19
  it "can call a POST based unmanaged extension that uses form-urlencoded" do
20
20
  headers = {'Content-Type' =>'application/x-www-form-urlencoded'}
21
21
  results = @neo.post_extention('/music/recommend', {"artist" => "Ministry", "song" => "Just one Fix"}, headers)
22
- results.should_not be_null
22
+ expect(results).not_to be_null
23
23
  end
24
24
 
25
25
  end
data/spec/matchers.rb CHANGED
@@ -5,7 +5,7 @@ RSpec::Matchers.define :json_match do |field, expected|
5
5
  expected == JSON.parse(actual[field])
6
6
  end
7
7
 
8
- failure_message_for_should do
8
+ failure_message do
9
9
  "expected JSON in field '#{field}' to match '#{expected}'"
10
10
  end
11
11
 
@@ -22,7 +22,7 @@ RSpec::Matchers.define :hash_match do |field, expected|
22
22
  expected == actual[field]
23
23
  end
24
24
 
25
- failure_message_for_should do
25
+ failure_message do
26
26
  "expected field '#{field}' to match '#{expected}'"
27
27
  end
28
28
 
@@ -5,16 +5,16 @@ describe Neography do
5
5
  describe "::configure" do
6
6
 
7
7
  it "returns the same configuration" do
8
- Neography.configuration.should == Neography.configuration
8
+ expect(Neography.configuration).to eq(Neography.configuration)
9
9
  end
10
10
 
11
11
  it "returns the Config" do
12
- Neography.configuration.should be_a Neography::Config
12
+ expect(Neography.configuration).to be_a Neography::Config
13
13
  end
14
14
 
15
15
  it "yields the configuration" do
16
16
  Neography.configure do |config|
17
- config.should == Neography.configuration
17
+ expect(config).to eq(Neography.configuration)
18
18
  end
19
19
  end
20
20
 
data/spec/spec_helper.rb CHANGED
@@ -27,10 +27,10 @@ end
27
27
 
28
28
  def error_response(attributes)
29
29
  request_uri = double()
30
- request_uri.stub(:request_uri).and_return("")
30
+ allow(request_uri).to receive(:request_uri).and_return("")
31
31
 
32
32
  http_header = double()
33
- http_header.stub(:request_uri).and_return(request_uri)
33
+ allow(http_header).to receive(:request_uri).and_return(request_uri)
34
34
 
35
35
  double(
36
36
  http_header: http_header,
@@ -7,25 +7,100 @@ module Neography
7
7
 
8
8
  context "defaults" do
9
9
 
10
- its(:protocol) { should == 'http://' }
11
- its(:server) { should == 'localhost' }
12
- its(:port) { should == 7474 }
13
- its(:directory) { should == '' }
14
- its(:cypher_path) { should == '/cypher' }
15
- its(:gremlin_path) { should == '/ext/GremlinPlugin/graphdb/execute_script' }
16
- its(:log_file) { should == 'neography.log' }
17
- its(:log_enabled) { should == false }
18
- its(:logger) { should == nil }
19
- its(:slow_log_threshold) { should == 0 }
20
- its(:max_threads) { should == 20 }
21
- its(:authentication) { should == nil }
22
- its(:username) { should == nil }
23
- its(:password) { should == nil }
24
- its(:parser) { should == MultiJsonParser}
25
- its(:max_execution_time) { should == 6000 }
26
- its(:proxy) { should == nil }
27
- its(:http_send_timeout) { should == 1200 }
28
- its(:http_receive_timeout) { should == 1200 }
10
+ describe '#protocol' do
11
+ subject { super().protocol }
12
+ it { should == 'http://' }
13
+ end
14
+
15
+ describe '#server' do
16
+ subject { super().server }
17
+ it { should == 'localhost' }
18
+ end
19
+
20
+ describe '#port' do
21
+ subject { super().port }
22
+ it { should == 7474 }
23
+ end
24
+
25
+ describe '#directory' do
26
+ subject { super().directory }
27
+ it { should == '' }
28
+ end
29
+
30
+ describe '#cypher_path' do
31
+ subject { super().cypher_path }
32
+ it { should == '/cypher' }
33
+ end
34
+
35
+ describe '#gremlin_path' do
36
+ subject { super().gremlin_path }
37
+ it { should == '/ext/GremlinPlugin/graphdb/execute_script' }
38
+ end
39
+
40
+ describe '#log_file' do
41
+ subject { super().log_file }
42
+ it { should == 'neography.log' }
43
+ end
44
+
45
+ describe '#log_enabled' do
46
+ subject { super().log_enabled }
47
+ it { should == false }
48
+ end
49
+
50
+ describe '#logger' do
51
+ subject { super().logger }
52
+ it { should == nil }
53
+ end
54
+
55
+ describe '#slow_log_threshold' do
56
+ subject { super().slow_log_threshold }
57
+ it { should == 0 }
58
+ end
59
+
60
+ describe '#max_threads' do
61
+ subject { super().max_threads }
62
+ it { should == 20 }
63
+ end
64
+
65
+ describe '#authentication' do
66
+ subject { super().authentication }
67
+ it { should == nil }
68
+ end
69
+
70
+ describe '#username' do
71
+ subject { super().username }
72
+ it { should == nil }
73
+ end
74
+
75
+ describe '#password' do
76
+ subject { super().password }
77
+ it { should == nil }
78
+ end
79
+
80
+ describe '#parser' do
81
+ subject { super().parser }
82
+ it { should == MultiJsonParser}
83
+ end
84
+
85
+ describe '#max_execution_time' do
86
+ subject { super().max_execution_time }
87
+ it { should == 6000 }
88
+ end
89
+
90
+ describe '#proxy' do
91
+ subject { super().proxy }
92
+ it { should == nil }
93
+ end
94
+
95
+ describe '#http_send_timeout' do
96
+ subject { super().http_send_timeout }
97
+ it { should == 1200 }
98
+ end
99
+
100
+ describe '#http_receive_timeout' do
101
+ subject { super().http_receive_timeout }
102
+ it { should == 1200 }
103
+ end
29
104
 
30
105
 
31
106
  it "has a hash representation" do
@@ -51,7 +126,7 @@ module Neography
51
126
  :http_receive_timeout => 1200
52
127
 
53
128
  }
54
- config.to_hash.should == expected_hash
129
+ expect(config.to_hash).to eq(expected_hash)
55
130
  end
56
131
 
57
132
  end
@@ -8,7 +8,7 @@ module Neography
8
8
  context "defaults" do
9
9
 
10
10
  it "intializes with defaults" do
11
- connection.configuration.should == "http://localhost:7474"
11
+ expect(connection.configuration).to eq("http://localhost:7474")
12
12
  end
13
13
 
14
14
  end
@@ -38,26 +38,26 @@ module Neography
38
38
  end
39
39
 
40
40
  it "accepts all options in a hash" do
41
- connection.configuration.should == "https://foobar:4242/dir"
42
-
43
- connection.protocol.should == "https://"
44
- connection.server.should == "foobar"
45
- connection.port.should == 4242
46
- connection.directory.should == "/dir"
47
- connection.cypher_path.should == "/cyph"
48
- connection.gremlin_path.should == "/grem"
49
- connection.log_file.should == "neo.log"
50
- connection.log_enabled.should == false
51
- connection.slow_log_threshold.should == 0
52
- connection.max_threads.should == 10
53
- connection.parser.should == Foo
54
-
55
- connection.authentication.should == {
41
+ expect(connection.configuration).to eq("https://foobar:4242/dir")
42
+
43
+ expect(connection.protocol).to eq("https://")
44
+ expect(connection.server).to eq("foobar")
45
+ expect(connection.port).to eq(4242)
46
+ expect(connection.directory).to eq("/dir")
47
+ expect(connection.cypher_path).to eq("/cyph")
48
+ expect(connection.gremlin_path).to eq("/grem")
49
+ expect(connection.log_file).to eq("neo.log")
50
+ expect(connection.log_enabled).to eq(false)
51
+ expect(connection.slow_log_threshold).to eq(0)
52
+ expect(connection.max_threads).to eq(10)
53
+ expect(connection.parser).to eq(Foo)
54
+
55
+ expect(connection.authentication).to eq({
56
56
  :foo_auth => {
57
57
  :username => "bar",
58
58
  :password => "baz"
59
59
  }
60
- }
60
+ })
61
61
  end
62
62
 
63
63
  context "httpclient" do
@@ -70,7 +70,7 @@ module Neography
70
70
  end
71
71
 
72
72
  it 'configures send/receive timeout' do
73
- Excon.should_receive(:new).with("http://localhost:7474",
73
+ expect(Excon).to receive(:new).with("http://localhost:7474",
74
74
  :read_timeout => 100,
75
75
  :write_timeout => 120,
76
76
  :persistent=>true,
@@ -87,13 +87,13 @@ module Neography
87
87
  let(:options) { "https://user:pass@somehost:8585/path" }
88
88
 
89
89
  it "accepts a string as configuration" do
90
- connection.configuration.should == "https://somehost:8585/path"
91
- connection.authentication.should == {
90
+ expect(connection.configuration).to eq("https://somehost:8585/path")
91
+ expect(connection.authentication).to eq({
92
92
  :basic_auth => {
93
93
  :username => "user",
94
94
  :password => "pass"
95
95
  }
96
- }
96
+ })
97
97
  end
98
98
  end
99
99
 
@@ -102,22 +102,22 @@ module Neography
102
102
  context "requests" do
103
103
 
104
104
  it "does a GET request" do
105
- connection.client.should_receive(:request).with(:method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
105
+ expect(connection.client).to receive(:request).with(:method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
106
106
  connection.get("/node/bar")
107
107
  end
108
108
 
109
109
  it "does a POST request" do
110
- connection.client.should_receive(:request).with(:method => :post, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
110
+ expect(connection.client).to receive(:request).with(:method => :post, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
111
111
  connection.post("/node/bar")
112
112
  end
113
113
 
114
114
  it "does a PUT request" do
115
- connection.client.should_receive(:request).with(:method => :put, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
115
+ expect(connection.client).to receive(:request).with(:method => :put, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
116
116
  connection.put("/node/bar")
117
117
  end
118
118
 
119
119
  it "does a DELETE request" do
120
- connection.client.should_receive(:request).with(:method => :delete, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
120
+ expect(connection.client).to receive(:request).with(:method => :delete, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
121
121
  connection.delete("/node/bar")
122
122
  end
123
123
 
@@ -131,12 +131,12 @@ module Neography
131
131
  end
132
132
 
133
133
  it "does requests with authentication" do
134
- connection.client.should_not_receive(:set_auth).with(
134
+ expect(connection.client).not_to receive(:set_auth).with(
135
135
  "http://localhost:7474/db/data/node/bar",
136
136
  "foo",
137
137
  "bar") { double.as_null_object }
138
138
 
139
- connection.client.should_receive(:request).with(
139
+ expect(connection.client).to receive(:request).with(
140
140
  :method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
141
141
 
142
142
  connection.get("/node/bar")
@@ -144,7 +144,7 @@ module Neography
144
144
  end
145
145
 
146
146
  it "adds the User-Agent to the headers" do
147
- connection.client.should_receive(:request).with(
147
+ expect(connection.client).to receive(:request).with(
148
148
  hash_including(
149
149
  {:method => :get, :path => "/db/data/node/bar", :body => nil,
150
150
  :headers => {"User-Agent" => "Neography/#{Neography::VERSION}", "X-Stream"=>true, "max-execution-time" => 6000}}
@@ -158,7 +158,7 @@ module Neography
158
158
 
159
159
  it "raises NodeNotFoundException" do
160
160
  response = error_response(code: 404, message: "a message", exception: "NodeNotFoundException")
161
- connection.client.stub(:request).and_return(response)
161
+ allow(connection.client).to receive(:request).and_return(response)
162
162
  expect {
163
163
  connection.get("/node/bar")
164
164
  }.to raise_error NodeNotFoundException
@@ -166,7 +166,7 @@ module Neography
166
166
 
167
167
  it "raises OperationFailureException" do
168
168
  response = error_response(code: 409, message: "a message", exception: "OperationFailureException")
169
- connection.client.stub(:request).and_return(response)
169
+ allow(connection.client).to receive(:request).and_return(response)
170
170
  expect {
171
171
  connection.get("/node/bar")
172
172
  }.to raise_error OperationFailureException
@@ -174,7 +174,7 @@ module Neography
174
174
 
175
175
  it "raises PropertyValueException" do
176
176
  response = error_response(code: 400, message: "a message", exception: "PropertyValueException")
177
- connection.client.stub(:request).and_return(response)
177
+ allow(connection.client).to receive(:request).and_return(response)
178
178
  expect {
179
179
  connection.get("/node/bar")
180
180
  }.to raise_error PropertyValueException
@@ -182,7 +182,7 @@ module Neography
182
182
 
183
183
  it "raises NoSuchPropertyException" do
184
184
  response = error_response(code: 404, message: "a message", exception: "NoSuchPropertyException")
185
- connection.client.stub(:request).and_return(response)
185
+ allow(connection.client).to receive(:request).and_return(response)
186
186
  expect {
187
187
  connection.get("/node/bar")
188
188
  }.to raise_error NoSuchPropertyException
@@ -190,7 +190,7 @@ module Neography
190
190
 
191
191
  it "raises RelationshipNotFoundException" do
192
192
  response = error_response(code: 404, message: "a message", exception: "RelationshipNotFoundException")
193
- connection.client.stub(:request).and_return(response)
193
+ allow(connection.client).to receive(:request).and_return(response)
194
194
  expect {
195
195
  connection.get("/node/bar")
196
196
  }.to raise_error RelationshipNotFoundException
@@ -198,7 +198,7 @@ module Neography
198
198
 
199
199
  it "raises BadInputException" do
200
200
  response = error_response(code: 400, message: "a message", exception: "BadInputException")
201
- connection.client.stub(:request).and_return(response)
201
+ allow(connection.client).to receive(:request).and_return(response)
202
202
  expect {
203
203
  connection.get("/node/bar")
204
204
  }.to raise_error BadInputException
@@ -206,7 +206,7 @@ module Neography
206
206
 
207
207
  it "raises UnauthorizedError" do
208
208
  response = error_response(code: 401)
209
- connection.client.stub(:request).and_return(response)
209
+ allow(connection.client).to receive(:request).and_return(response)
210
210
  expect {
211
211
  connection.get("/node/bar")
212
212
  }.to raise_error UnauthorizedError
@@ -214,7 +214,7 @@ module Neography
214
214
 
215
215
  it "raises NeographyError in all other cases" do
216
216
  response = error_response(code: 418, message: "I'm a teapot.")
217
- connection.client.stub(:request).and_return(response)
217
+ allow(connection.client).to receive(:request).and_return(response)
218
218
  expect {
219
219
  connection.get("/node/bar")
220
220
  }.to raise_error NeographyError
@@ -222,7 +222,7 @@ module Neography
222
222
 
223
223
  it "raises BadInputException" do
224
224
  response = error_response(code: 500, message: "a message", exception: "JsonParseException")
225
- connection.client.stub(:request).and_return(response)
225
+ allow(connection.client).to receive(:request).and_return(response)
226
226
  expect {
227
227
  connection.get("/node/bar")
228
228
  }.to raise_error NeographyError
@@ -255,19 +255,19 @@ module Neography
255
255
 
256
256
  describe "slow_log_threshold" do
257
257
  before do
258
- connection.stub(:evaluate_response).and_return expected_response
258
+ allow(connection).to receive(:evaluate_response).and_return expected_response
259
259
  end
260
260
 
261
261
  context "default value" do
262
262
  it "should have output" do
263
- @logger.should_receive(:info).once
263
+ expect(@logger).to receive(:info).once
264
264
  end
265
265
  end
266
266
 
267
267
  context "high value" do
268
268
  before { connection.slow_log_threshold = 100_000 }
269
269
  it "should not have output" do
270
- @logger.should_not_receive(:info)
270
+ expect(@logger).not_to receive(:info)
271
271
  end
272
272
  end
273
273