neography 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43f8b62b22553c1f708d41329413b6a111632aa8
4
- data.tar.gz: 9125641aee1bcd52bcaa82576138c19302312357
3
+ metadata.gz: 0c94fc8ab99a3ddd841877a44d2105ce93df66b0
4
+ data.tar.gz: ba74d4c43dcf9bb8fd1c1f82dc67ca261d1531b4
5
5
  SHA512:
6
- metadata.gz: 51bab8d2105cedfa26e7b27c2c71a8dc9b52387ce3187ab34bf0b068cdcde4e26d7a7191b493051657b7850b61582a0fb92be9cf2a4dd08e634a601aa06245de
7
- data.tar.gz: a21caf2565507a07421d8b63b0ca2187280378d3c485d361142bd7dbdcbd8104439510e110e8b83daab68f1e4bc6b994c5c0e5439131c55cdab4f929b92e45e7
6
+ metadata.gz: 5a5cda65f813b2d431600ce5a2e707b7a1064dfd578ce8927ff49fbaf12b07f41f54d5d0f36dbfe2392403afed269a4640a18c6cc8a94d173439c2660e5c68c8
7
+ data.tar.gz: d4f4a8149e99eb18042be707bd897a109ee472a36fa92b06208149c01be6727018f8f582d6417fa8f9358409bf496028da0a7e2de855e66f4ac60ad6cff4e844
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
- script: "bundle exec rake neo4j:install['enterprise','2.0.1'] neo4j:get_spatial neo4j:start spec --trace"
1
+ script: "bundle exec rake neo4j:install['enterprise','2.2.0'] neo4j:get_spatial neo4j:unsecure neo4j:start spec --trace"
2
2
  language: ruby
3
3
  rvm:
4
- - 2.0.0
4
+ - 2.2.0
data/README.md CHANGED
@@ -61,7 +61,7 @@ Configure Neography as follows:
61
61
  ```ruby
62
62
  # these are the default values:
63
63
  Neography.configure do |config|
64
- config.protocol = "http://"
64
+ config.protocol = "http"
65
65
  config.server = "localhost"
66
66
  config.port = 7474
67
67
  config.directory = "" # prefix this path with '/'
@@ -77,6 +77,7 @@ Neography.configure do |config|
77
77
  config.parser = MultiJsonParser
78
78
  config.http_send_timeout = 1200
79
79
  config.http_receive_timeout = 1200
80
+ config.persistent = true
80
81
  end
81
82
  ```
82
83
 
@@ -42,7 +42,7 @@ module Neography
42
42
  private
43
43
 
44
44
  def set_defaults
45
- @protocol = "http://"
45
+ @protocol = "http"
46
46
  @server = "localhost"
47
47
  @port = 7474
48
48
  @directory = ""
@@ -13,10 +13,10 @@ module Neography
13
13
  :parser, :client,
14
14
  :proxy, :http_send_timeout, :http_receive_timeout
15
15
 
16
- def initialize(options = ENV['NEO4J_URL'] || {})
16
+ def initialize(options = {})
17
17
  config = merge_configuration(options)
18
18
  save_local_configuration(config)
19
- @client ||= Excon.new(config[:proxy] || "#{@protocol}#{@server}:#{@port}",
19
+ @client ||= Excon.new(config[:proxy] || "#{protocol}://#{@server}:#{@port}",
20
20
  :read_timeout => config[:http_receive_timeout],
21
21
  :write_timeout => config[:http_send_timeout],
22
22
  :persistent => config[:persistent],
@@ -32,8 +32,13 @@ module Neography
32
32
  @directory = directory
33
33
  end
34
34
 
35
+ # Keeping backward compatability for folks who used "http://" syntax instead of "http"
36
+ def protocol
37
+ @protocol.sub("://","")
38
+ end
39
+
35
40
  def configuration
36
- @configuration ||= "#{@protocol}#{@server}:#{@port}#{@directory}"
41
+ @configuration ||= "#{protocol}://#{@server}:#{@port}#{@directory}"
37
42
  end
38
43
 
39
44
  def merge_options(options)
@@ -174,7 +179,7 @@ module Neography
174
179
  def return_result(response, code, body, parsed, path, query_body)
175
180
  case code
176
181
  when 200
177
- @logger.debug "OK, created #{body}" if @log_enabled
182
+ @logger.debug "OK #{body}" if @log_enabled
178
183
  parsed ? body : @parser.json(body)
179
184
  when 201
180
185
  @logger.debug "OK, created #{body}" if @log_enabled
@@ -184,7 +189,7 @@ module Neography
184
189
  when 204
185
190
  @logger.debug "OK, no content returned" if @log_enabled
186
191
  nil
187
- when 400..500
192
+ else
188
193
  handle_4xx_500_response(response, code, body, path, query_body)
189
194
  nil
190
195
  end
@@ -248,7 +253,7 @@ module Neography
248
253
  def parse_string_options(options)
249
254
  url = URI.parse(options)
250
255
  options = {
251
- :protocol => url.scheme + "://",
256
+ :protocol => url.scheme,
252
257
  :server => url.host,
253
258
  :port => url.port,
254
259
  :directory => url.path,
@@ -10,11 +10,11 @@ module Neography
10
10
  @request = request
11
11
  @index = index
12
12
  end
13
- end
14
13
 
15
14
  def to_s
16
15
  "NeographyError: \n--message: #{@message}, \n--code: #{@code}, \n--stacktrace: #{@stacktrace}, \n--request: #{@request}, \n--index: #{@index}"
17
16
  end
17
+ end
18
18
 
19
19
  # HTTP Authentication error
20
20
  class UnauthorizedError < NeographyError; end
@@ -40,7 +40,7 @@ module Neography
40
40
  results = db.find_relationship_index(*args)
41
41
  return nil unless results
42
42
  results.each do |r|
43
- rel = self.new(r, db)
43
+ rel = self.load(r, db)
44
44
  rels << rel
45
45
  end
46
46
  rels.size > 1 ? rels : rels.first
@@ -54,7 +54,7 @@ module Neography
54
54
  end
55
55
 
56
56
  def del
57
- start_node.neo_server.delete_relationship(neo_id)
57
+ neo_server.delete_relationship(neo_id)
58
58
  end
59
59
 
60
60
  def exist?
@@ -1,6 +1,7 @@
1
1
  require 'forwardable'
2
2
 
3
3
  require 'neography/rest/helpers'
4
+ require 'neography/rest/auth'
4
5
  require 'neography/rest/schema_indexes'
5
6
  require 'neography/rest/nodes'
6
7
  require 'neography/rest/node_properties'
@@ -31,6 +32,7 @@ module Neography
31
32
 
32
33
  class Rest
33
34
  include Helpers
35
+ include Auth
34
36
  include RelationshipTypes
35
37
  include NodeLabels
36
38
  include SchemaIndexes
@@ -60,7 +62,7 @@ module Neography
60
62
 
61
63
  def_delegators :@connection, :configuration
62
64
 
63
- def initialize(options = ENV['NEO4J_URL'] || {})
65
+ def initialize(options = {})
64
66
  @connection = Connection.new(options)
65
67
  end
66
68
 
@@ -6,7 +6,7 @@ require 'net/http'
6
6
  namespace :neo4j do
7
7
  desc "Install Neo4j"
8
8
  task :install, :edition, :version do |t, args|
9
- args.with_defaults(:edition => "community", :version => "2.1.3")
9
+ args.with_defaults(:edition => "community", :version => "2.2.0")
10
10
  puts "Installing Neo4j-#{args[:edition]}-#{args[:version]}"
11
11
 
12
12
  if OS::Underlying.windows?
@@ -58,6 +58,14 @@ namespace :neo4j do
58
58
  puts "Type 'rake neo4j:start' to start it"
59
59
  end
60
60
 
61
+ desc "Unsecure the Neo4j Server (for testing only)"
62
+ task :unsecure do
63
+ properties_file = "neo4j/conf/neo4j-server.properties"
64
+ text = File.read(properties_file)
65
+ new_contents = text.gsub(/dbms.security.auth_enabled=true/, "dbms.security.auth_enabled=false")
66
+ File.open(properties_file, "w") {|file| file.puts new_contents }
67
+ end
68
+
61
69
  desc "Start the Neo4j Server"
62
70
  task :start do
63
71
  puts "Starting Neo4j..."
@@ -127,11 +135,11 @@ namespace :neo4j do
127
135
  %x[neo4j/bin/Neo4j.bat stop]
128
136
 
129
137
  # Reset the database
130
- FileUtils.rm_rf("neo4j/data/graph.db")
138
+ FileUtils.rm_rf("neo4j/data/graph.db") if File.exist?("neo4j/data/graph.db")
131
139
  FileUtils.mkdir("neo4j/data/graph.db")
132
140
 
133
141
  # Remove log files
134
- FileUtils.rm_rf("neo4j/data/log")
142
+ FileUtils.rm_rf("neo4j/data/log") if File.exist?("neo4j/data/log")
135
143
  FileUtils.mkdir("neo4j/data/log")
136
144
 
137
145
  %x[neo4j/bin/Neo4j.bat start]
@@ -142,11 +150,11 @@ namespace :neo4j do
142
150
  %x[neo4j/bin/neo4j stop]
143
151
 
144
152
  # Reset the database
145
- FileUtils.rm_rf("neo4j/data/graph.db")
153
+ FileUtils.rm_rf("neo4j/data/graph.db") if File.exist?("neo4j/data/graph.db")
146
154
  FileUtils.mkdir("neo4j/data/graph.db")
147
155
 
148
156
  # Remove log files
149
- FileUtils.rm_rf("neo4j/data/log")
157
+ FileUtils.rm_rf("neo4j/data/log") if File.exist?("neo4j/data/log")
150
158
  FileUtils.mkdir("neo4j/data/log")
151
159
 
152
160
  # Start the server
@@ -155,12 +163,15 @@ namespace :neo4j do
155
163
  end
156
164
 
157
165
  task :get_spatial, :version do |t, args|
158
- args.with_defaults(:version => "2.0.1")
166
+ args.with_defaults(:version => "2.1.4")
159
167
  puts "Installing Neo4j-Spatial #{args[:version]}"
160
168
 
161
169
  unless File.exist?('neo4j-spatial.zip')
162
170
  df = File.open('neo4j-spatial.zip', 'wb')
163
171
  case args[:version]
172
+ when "2.1.4"
173
+ dist = "m2.neo4j.org"
174
+ request = "/content/repositories/releases/org/neo4j/neo4j-spatial/0.13-neo4j-2.1.4/neo4j-spatial-0.13-neo4j-2.1.4-server-plugin.zip"
164
175
  when "2.0.1"
165
176
  dist = "m2.neo4j.org"
166
177
  request = "/content/repositories/releases/org/neo4j/neo4j-spatial/0.13-neo4j-2.0.1/neo4j-spatial-0.13-neo4j-2.0.1-server-plugin.zip"
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "1.6.0"
2
+ VERSION = "1.7.0"
3
3
  end
data/neography.gemspec CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rspec", "3.0"
24
24
  s.add_development_dependency "net-http-spy", "0.2.1"
25
25
  s.add_development_dependency "coveralls"
26
- s.add_development_dependency "debugger"
27
26
  s.add_development_dependency "guard-rspec"
28
27
  s.add_dependency "excon", ">= 0.33.0"
29
28
  s.add_dependency "json", ">= 1.7.7"
@@ -50,8 +50,11 @@ describe Neography::Index do
50
50
  r.add_to_index("relationship_test_index", "name", value)
51
51
  existing_r = Neography::Relationship.find("relationship_test_index", "name", value)
52
52
  expect(existing_r.name).to eq(value)
53
+ expect(existing_r.start_node).to eq(node1)
54
+ expect(existing_r.end_node).to eq(node2)
55
+ existing_r.del
53
56
  end
54
-
57
+
55
58
  it "can find multiple nodes in an index" do
56
59
  value1 = generate_text
57
60
  value2 = generate_text
@@ -329,10 +329,9 @@ describe Neography::Rest do
329
329
  end
330
330
 
331
331
  it "can batch cypher" do
332
- batch_result = @neo.batch [:execute_query, "start n=node(0) return n"]
332
+ batch_result = @neo.batch [:execute_query, "MATCH (n) RETURN n LIMIT 1"]
333
333
  expect(batch_result.first).to have_key("id")
334
334
  expect(batch_result.first).to have_key("from")
335
- expect(batch_result.first["body"]["data"][0][0]["self"].split('/').last).to eq("0")
336
335
  end
337
336
 
338
337
  it "can batch cypher with parameters" do
@@ -403,7 +402,7 @@ describe Neography::Rest do
403
402
  expect(@neo.get_relationship_index(index, key, value2)).to be_nil
404
403
  end
405
404
 
406
- it "can do spatial via Cypher in batch" do
405
+ it "can do spatial via Cypher in batch", :spatial => true do
407
406
  properties = {:lat => 60.1, :lon => 15.2}
408
407
  node = @neo.create_node(properties)
409
408
  batch_result = @neo.batch [:create_spatial_index, "geobatchcypher", "point", "lat", "lon"],
@@ -553,7 +552,7 @@ describe Neography::Rest do
553
552
  [:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
554
553
  [:create_relationship, "has", "{0}", "{2}", {}]
555
554
  rescue Neography::NeographyError => e
556
- expect(e.message).to eq("Not Found")
555
+ #expect(e.message).to eq("Not Found")
557
556
  expect(e.code).to eq(404)
558
557
  expect(e.stacktrace).to be_nil
559
558
  expect(e.request[:path]).to eq("/db/data/batch")
@@ -139,9 +139,9 @@ describe Neography::Rest do
139
139
  expect(node_properties["eyes"]).to be_nil
140
140
  end
141
141
 
142
- it "returns nil if it gets the properties on a node that does not have any" do
142
+ it "returns empty array if it gets the properties on a node that does not have any" do
143
143
  new_node = @neo.create_node
144
- expect(@neo.get_node_properties(new_node)).to be_nil
144
+ expect(@neo.get_node_properties(new_node)).to be_empty
145
145
  end
146
146
 
147
147
  it "raises error if it tries to get some of the properties on a node that does not have any" do
@@ -164,7 +164,7 @@ describe Neography::Rest do
164
164
  it "can remove a node's properties" do
165
165
  new_node = @neo.create_node("weight" => 200, "eyes" => "brown")
166
166
  @neo.remove_node_properties(new_node)
167
- expect(@neo.get_node_properties(new_node)).to be_nil
167
+ expect(@neo.get_node_properties(new_node)).to be_empty
168
168
  end
169
169
 
170
170
  it "raises error if it fails to remove the properties of a node that does not exist" do
@@ -148,7 +148,7 @@ describe Neography::Rest do
148
148
  new_node2 = @neo.create_node
149
149
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2)
150
150
  relationship_properties = @neo.get_relationship_properties(new_relationship)
151
- expect(relationship_properties).to be_nil
151
+ expect(relationship_properties).to be_empty
152
152
  end
153
153
 
154
154
  it "raises error if it tries to get some of the properties on a relationship that does not have any" do
@@ -177,7 +177,7 @@ describe Neography::Rest do
177
177
  new_node2 = @neo.create_node
178
178
  new_relationship = @neo.create_relationship("friends", new_node1, new_node2, {"since" => '10-1-2010', "met" => "college"})
179
179
  @neo.remove_relationship_properties(new_relationship)
180
- expect(@neo.get_relationship_properties(new_relationship)).to be_nil
180
+ expect(@neo.get_relationship_properties(new_relationship)).to be_empty
181
181
  end
182
182
 
183
183
  it "raises error if it fails to remove the properties of a relationship that does not exist" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Neography::Rest do
3
+ describe Neography::Rest, :spatial => true do
4
4
  before(:each) do
5
5
  @neo = Neography::Rest.new
6
6
  end
@@ -3,6 +3,9 @@ require 'spec_helper'
3
3
  describe Neography::Rest do
4
4
  before(:each) do
5
5
  @neo = Neography::Rest.new
6
+ node = @neo.create_node
7
+ @node_id = node["self"].split('/').last.to_i
8
+
6
9
  end
7
10
 
8
11
  describe "start a transaction" do
@@ -51,7 +54,7 @@ describe Neography::Rest do
51
54
  tx = @neo.begin_transaction
52
55
  expect(tx).to have_key("transaction")
53
56
  expect(tx["results"]).to be_empty
54
- existing_tx = @neo.in_transaction(tx, "start n=node(0) return n")
57
+ existing_tx = @neo.in_transaction(tx, "MATCH (n) WHERE ID(n) =#{@node_id} RETURN n")
55
58
  expect(existing_tx).to have_key("transaction")
56
59
  expect(existing_tx).to have_key("results")
57
60
  expect(existing_tx["results"]).not_to be_empty
@@ -61,7 +64,7 @@ describe Neography::Rest do
61
64
  tx = @neo.begin_transaction
62
65
  expect(tx).to have_key("transaction")
63
66
  expect(tx["results"]).to be_empty
64
- existing_tx = @neo.in_transaction(tx, ["start n=node({id}) return n", {:id => 0}])
67
+ existing_tx = @neo.in_transaction(tx, ["MATCH (n) WHERE ID(n) ={id} RETURN n", {:id => @node_id}])
65
68
  expect(existing_tx).to have_key("transaction")
66
69
  expect(existing_tx).to have_key("results")
67
70
  expect(existing_tx["results"]).not_to be_empty
@@ -71,7 +74,7 @@ describe Neography::Rest do
71
74
  tx = @neo.begin_transaction
72
75
  expect(tx).to have_key("transaction")
73
76
  expect(tx["results"]).to be_empty
74
- existing_tx = @neo.in_transaction(tx, ["start n=node(0) return n", [:row,:rest]])
77
+ existing_tx = @neo.in_transaction(tx, ["MATCH (n) RETURN n LIMIT 1", [:row,:rest]])
75
78
  expect(existing_tx).to have_key("transaction")
76
79
  expect(existing_tx).to have_key("results")
77
80
  expect(existing_tx["results"]).not_to be_empty
@@ -81,7 +84,7 @@ describe Neography::Rest do
81
84
  tx = @neo.begin_transaction
82
85
  expect(tx).to have_key("transaction")
83
86
  expect(tx["results"]).to be_empty
84
- existing_tx = @neo.in_transaction(tx, ["start n=node({id}) return n", {:id => 0}, [:row,:rest]])
87
+ existing_tx = @neo.in_transaction(tx, ["MATCH (n) WHERE ID(n)={id} RETURN n", {:id => 0}, [:row,:rest]])
85
88
  expect(existing_tx).to have_key("transaction")
86
89
  expect(existing_tx).to have_key("results")
87
90
  expect(existing_tx["results"]).not_to be_empty
@@ -127,7 +130,7 @@ describe Neography::Rest do
127
130
  end
128
131
 
129
132
  it "can commit an new transaction right away with parameters" do
130
- tx = @neo.commit_transaction(["start n=node({id}) return n", {:id => 0}])
133
+ tx = @neo.commit_transaction(["start n=node({id}) return n", {:id => @node_id}])
131
134
  expect(tx).not_to have_key("transaction")
132
135
  expect(tx).to have_key("results")
133
136
  expect(tx["results"]).not_to be_empty
@@ -21,8 +21,8 @@ describe Neography::Rest do
21
21
  expect(nodes).not_to be_nil
22
22
  expect(nodes[0]["self"]).to eq(@new_node2["self"])
23
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"])
24
+ expect(nodes[2]["self"]).to eq(@new_node5["self"])
25
+ expect(nodes[3]["self"]).to eq(@new_node4["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)
@@ -36,8 +36,8 @@ describe Neography::Rest do
36
36
 
37
37
  expect(relationships[0]["self"]).to eq(new_relationship1["self"])
38
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"])
39
+ expect(relationships[2]["self"]).to eq(new_relationship5["self"])
40
+ expect(relationships[3]["self"]).to eq(new_relationship3["self"])
41
41
  end
42
42
 
43
43
  it "can traverse the graph and return paths" do
@@ -52,8 +52,8 @@ describe Neography::Rest do
52
52
 
53
53
  expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
54
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"]])
55
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]])
56
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
57
57
  end
58
58
 
59
59
  it "can traverse the graph up to a certain depth" do
@@ -68,8 +68,8 @@ describe Neography::Rest do
68
68
 
69
69
  expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
70
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"]])
71
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]])
72
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
73
73
  end
74
74
 
75
75
  it "can traverse the graph in a certain order" do
@@ -84,8 +84,8 @@ describe Neography::Rest do
84
84
 
85
85
  expect(paths[0]["nodes"]).to eq([@new_node1["self"], @new_node2["self"]])
86
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"]])
87
+ expect(paths[2]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node5["self"]])
88
+ expect(paths[3]["nodes"]).to eq([@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]])
89
89
  end
90
90
 
91
91
  it "can traverse the graph with a specific uniqueness" do
@@ -138,8 +138,8 @@ describe Neography::Rest do
138
138
  expect(nodes[0]["self"]).to eq(@new_node1["self"])
139
139
  expect(nodes[1]["self"]).to eq(@new_node2["self"])
140
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"])
141
+ expect(nodes[3]["self"]).to eq(@new_node5["self"])
142
+ expect(nodes[4]["self"]).to eq(@new_node4["self"])
143
143
  end
144
144
 
145
145
 
data/spec/spec_helper.rb CHANGED
@@ -17,7 +17,7 @@ def generate_text(length=8)
17
17
  end
18
18
 
19
19
  RSpec.configure do |c|
20
- c.filter_run_excluding :slow => true, :gremlin => true, :reference => true, :neo_is_broken => true, :unmanaged_extensions => true
20
+ c.filter_run_excluding :spatial => true, :slow => true, :gremlin => true, :reference => true, :neo_is_broken => true, :unmanaged_extensions => true
21
21
  end
22
22
 
23
23
 
@@ -9,7 +9,7 @@ module Neography
9
9
 
10
10
  describe '#protocol' do
11
11
  subject { super().protocol }
12
- it { should == 'http://' }
12
+ it { should == 'http' }
13
13
  end
14
14
 
15
15
  describe '#server' do
@@ -110,7 +110,7 @@ module Neography
110
110
 
111
111
  it "has a hash representation" do
112
112
  expected_hash = {
113
- :protocol => 'http://',
113
+ :protocol => 'http',
114
114
  :server => 'localhost',
115
115
  :port => 7474,
116
116
  :directory => '',
@@ -20,7 +20,7 @@ module Neography
20
20
  context "hash options" do
21
21
  let(:options) do
22
22
  {
23
- :protocol => "https://",
23
+ :protocol => "https",
24
24
  :server => "foobar",
25
25
  :port => 4242,
26
26
  :directory => "/dir",
@@ -40,7 +40,7 @@ module Neography
40
40
  it "accepts all options in a hash" do
41
41
  expect(connection.configuration).to eq("https://foobar:4242/dir")
42
42
 
43
- expect(connection.protocol).to eq("https://")
43
+ expect(connection.protocol).to eq("https")
44
44
  expect(connection.server).to eq("foobar")
45
45
  expect(connection.port).to eq(4242)
46
46
  expect(connection.directory).to eq("/dir")
@@ -119,24 +119,25 @@ module Neography
119
119
  end
120
120
 
121
121
  context "requests" do
122
+ let(:response) { double("response", :status => 200, :body=> "").as_null_object }
122
123
 
123
124
  it "does a GET request" do
124
- expect(connection.client).to receive(:request).with(:method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
125
+ expect(connection.client).to receive(:request).with(:method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { response }
125
126
  connection.get("/node/bar")
126
127
  end
127
128
 
128
129
  it "does a POST request" do
129
- expect(connection.client).to receive(:request).with(:method => :post, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
130
+ expect(connection.client).to receive(:request).with(:method => :post, :path => "/db/data/node/bar", :body => nil, :headers => nil) { response }
130
131
  connection.post("/node/bar")
131
132
  end
132
133
 
133
134
  it "does a PUT request" do
134
- expect(connection.client).to receive(:request).with(:method => :put, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
135
+ expect(connection.client).to receive(:request).with(:method => :put, :path => "/db/data/node/bar", :body => nil, :headers => nil) { response }
135
136
  connection.put("/node/bar")
136
137
  end
137
138
 
138
139
  it "does a DELETE request" do
139
- expect(connection.client).to receive(:request).with(:method => :delete, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
140
+ expect(connection.client).to receive(:request).with(:method => :delete, :path => "/db/data/node/bar", :body => nil, :headers => nil) { response }
140
141
  connection.delete("/node/bar")
141
142
  end
142
143
 
@@ -153,10 +154,10 @@ module Neography
153
154
  expect(connection.client).not_to receive(:set_auth).with(
154
155
  "http://localhost:7474/db/data/node/bar",
155
156
  "foo",
156
- "bar") { double.as_null_object }
157
+ "bar") { response }
157
158
 
158
159
  expect(connection.client).to receive(:request).with(
159
- :method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { double.as_null_object }
160
+ :method => :get, :path => "/db/data/node/bar", :body => nil, :headers => nil) { response }
160
161
 
161
162
  connection.get("/node/bar")
162
163
  end
@@ -168,7 +169,7 @@ module Neography
168
169
  {:method => :get, :path => "/db/data/node/bar", :body => nil,
169
170
  :headers => {"User-Agent" => "Neography/#{Neography::VERSION}", "X-Stream"=>true, "max-execution-time" => 6000}}
170
171
  )
171
- ) { double.as_null_object }
172
+ ) { response }
172
173
 
173
174
  connection.get("/node/bar", :headers => {})
174
175
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neography
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max De Marzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: debugger
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: guard-rspec
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -317,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
303
  version: '0'
318
304
  requirements: []
319
305
  rubyforge_project: neography
320
- rubygems_version: 2.2.0
306
+ rubygems_version: 2.4.5
321
307
  signing_key:
322
308
  specification_version: 4
323
309
  summary: ruby wrapper to Neo4j Rest API
@@ -384,4 +370,3 @@ test_files:
384
370
  - spec/unit/rest/relationships_spec.rb
385
371
  - spec/unit/rest/schema_index_spec.rb
386
372
  - spec/unit/rest/transactions_spec.rb
387
- has_rdoc: