neography 0.0.31 → 1.0.0

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 (85) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +1 -1
  3. data/CONTRIBUTORS +2 -1
  4. data/README.md +247 -0
  5. data/Rakefile +1 -2
  6. data/lib/neography/config.rb +48 -16
  7. data/lib/neography/connection.rb +151 -0
  8. data/lib/neography/errors.rb +42 -0
  9. data/lib/neography/node.rb +17 -14
  10. data/lib/neography/node_relationship.rb +3 -1
  11. data/lib/neography/node_traverser.rb +24 -20
  12. data/lib/neography/property.rb +31 -28
  13. data/lib/neography/property_container.rb +1 -1
  14. data/lib/neography/relationship.rb +16 -19
  15. data/lib/neography/rest/auto_indexes.rb +64 -0
  16. data/lib/neography/rest/batch.rb +262 -0
  17. data/lib/neography/rest/clean.rb +19 -0
  18. data/lib/neography/rest/cypher.rb +24 -0
  19. data/lib/neography/rest/gremlin.rb +24 -0
  20. data/lib/neography/rest/helpers.rb +26 -0
  21. data/lib/neography/rest/indexes.rb +97 -0
  22. data/lib/neography/rest/node_auto_indexes.rb +14 -0
  23. data/lib/neography/rest/node_indexes.rb +35 -0
  24. data/lib/neography/rest/node_paths.rb +57 -0
  25. data/lib/neography/rest/node_properties.rb +11 -0
  26. data/lib/neography/rest/node_relationships.rb +53 -0
  27. data/lib/neography/rest/node_traversal.rb +81 -0
  28. data/lib/neography/rest/nodes.rb +102 -0
  29. data/lib/neography/rest/paths.rb +36 -0
  30. data/lib/neography/rest/properties.rb +56 -0
  31. data/lib/neography/rest/relationship_auto_indexes.rb +14 -0
  32. data/lib/neography/rest/relationship_indexes.rb +35 -0
  33. data/lib/neography/rest/relationship_properties.rb +11 -0
  34. data/lib/neography/rest/relationships.rb +23 -0
  35. data/lib/neography/rest.rb +285 -615
  36. data/lib/neography/tasks.rb +1 -1
  37. data/lib/neography/version.rb +1 -1
  38. data/lib/neography.rb +13 -2
  39. data/neography.gemspec +8 -8
  40. data/spec/integration/authorization_spec.rb +2 -2
  41. data/spec/integration/index_spec.rb +4 -4
  42. data/spec/integration/neography_spec.rb +2 -2
  43. data/spec/integration/node_path_spec.rb +2 -2
  44. data/spec/integration/node_relationship_spec.rb +5 -3
  45. data/spec/integration/node_spec.rb +20 -19
  46. data/spec/integration/parsing_spec.rb +2 -2
  47. data/spec/integration/relationship_spec.rb +2 -2
  48. data/spec/integration/rest_batch_spec.rb +28 -28
  49. data/spec/integration/rest_bulk_spec.rb +2 -2
  50. data/spec/integration/rest_experimental_spec.rb +2 -2
  51. data/spec/integration/rest_gremlin_fail_spec.rb +2 -2
  52. data/spec/integration/rest_header_spec.rb +4 -9
  53. data/spec/integration/rest_index_spec.rb +21 -1
  54. data/spec/integration/rest_node_spec.rb +58 -44
  55. data/spec/integration/rest_path_spec.rb +5 -5
  56. data/spec/integration/rest_plugin_spec.rb +8 -2
  57. data/spec/integration/rest_relationship_spec.rb +35 -30
  58. data/spec/integration/rest_traverse_spec.rb +2 -2
  59. data/spec/matchers.rb +33 -0
  60. data/spec/neography_spec.rb +23 -0
  61. data/spec/spec_helper.rb +19 -1
  62. data/spec/unit/config_spec.rb +46 -0
  63. data/spec/unit/connection_spec.rb +205 -0
  64. data/spec/unit/node_spec.rb +100 -0
  65. data/spec/unit/properties_spec.rb +136 -0
  66. data/spec/unit/relationship_spec.rb +118 -0
  67. data/spec/unit/rest/batch_spec.rb +243 -0
  68. data/spec/unit/rest/clean_spec.rb +17 -0
  69. data/spec/unit/rest/cypher_spec.rb +21 -0
  70. data/spec/unit/rest/gremlin_spec.rb +26 -0
  71. data/spec/unit/rest/node_auto_indexes_spec.rb +67 -0
  72. data/spec/unit/rest/node_indexes_spec.rb +126 -0
  73. data/spec/unit/rest/node_paths_spec.rb +80 -0
  74. data/spec/unit/rest/node_properties_spec.rb +80 -0
  75. data/spec/unit/rest/node_relationships_spec.rb +78 -0
  76. data/spec/unit/rest/node_traversal_spec.rb +128 -0
  77. data/spec/unit/rest/nodes_spec.rb +188 -0
  78. data/spec/unit/rest/paths_spec.rb +69 -0
  79. data/spec/unit/rest/relationship_auto_indexes_spec.rb +67 -0
  80. data/spec/unit/rest/relationship_indexes_spec.rb +128 -0
  81. data/spec/unit/rest/relationship_properties_spec.rb +80 -0
  82. data/spec/unit/rest/relationships_spec.rb +22 -0
  83. metadata +86 -19
  84. data/Gemfile.lock +0 -44
  85. data/README.rdoc +0 -420
@@ -4,7 +4,7 @@ require 'os'
4
4
  namespace :neo4j do
5
5
  desc "Install Neo4j"
6
6
  task :install, :edition, :version do |t, args|
7
- args.with_defaults(:edition => "community", :version => "1.7")
7
+ args.with_defaults(:edition => "community", :version => "1.8")
8
8
  puts "Installing Neo4j-#{args[:edition]}-#{args[:version]}"
9
9
 
10
10
  if OS::Underlying.windows?
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "0.0.31"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/neography.rb CHANGED
@@ -13,8 +13,6 @@ def find_and_require_user_defined_code
13
13
  end
14
14
  end
15
15
 
16
- DIRECTIONS = ["incoming", "in", "outgoing", "out", "all", "both"]
17
-
18
16
  require 'cgi'
19
17
  require 'httparty'
20
18
  require 'json'
@@ -29,7 +27,9 @@ require 'neography/multi_json_parser'
29
27
  require 'neography/version'
30
28
 
31
29
  require 'neography/config'
30
+
32
31
  require 'neography/rest'
32
+
33
33
  require 'neography/neography'
34
34
 
35
35
  require 'neography/property_container'
@@ -49,3 +49,14 @@ require 'neography/railtie' if defined? Rails::Railtie
49
49
 
50
50
  find_and_require_user_defined_code
51
51
 
52
+ module Neography
53
+
54
+ def self.configure
55
+ yield configuration
56
+ end
57
+
58
+ def self.configuration
59
+ @configuration ||= Config.new
60
+ end
61
+
62
+ end
data/neography.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = "maxdemarzi@gmail.com"
11
11
  s.homepage = "http://rubygems.org/gems/neography"
12
12
  s.summary = "ruby wrapper to Neo4j Rest API"
13
- s.description = "A Ruby wrapper to the Neo4j Rest API see http://components.neo4j.org/neo4j-rest/ for more details."
13
+ s.description = "A Ruby wrapper to the Neo4j Rest API see http://docs.neo4j.org/chunked/stable/rest-api.html for more details."
14
14
 
15
15
  s.rubyforge_project = "neography"
16
16
 
@@ -19,13 +19,13 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rspec", ">= 2.0"
23
23
  s.add_development_dependency "net-http-spy", "0.2.1"
24
- s.add_development_dependency "rake"
24
+ s.add_development_dependency "rake", ">= 0.8.7"
25
25
  s.add_dependency "httparty", ">= 0.8.1"
26
- s.add_dependency "rake"
27
- s.add_dependency "json"
28
- s.add_dependency "os"
29
- s.add_dependency "rubyzip"
30
- s.add_dependency "multi_json"
26
+ s.add_dependency "rake", ">= 0.8.7"
27
+ s.add_dependency "json", ">= 1.6.0"
28
+ s.add_dependency "os", ">= 0.9.6"
29
+ s.add_dependency "rubyzip", ">= 0.9.7"
30
+ s.add_dependency "multi_json", ">= 1.3.2"
31
31
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest, :slow => true do
4
4
  describe "basic authentication" do
@@ -45,4 +45,4 @@ describe Neography::Rest, :slow => true do
45
45
  end
46
46
  end
47
47
 
48
- end
48
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Index do
4
4
 
@@ -6,7 +6,7 @@ describe Neography::Index do
6
6
  new_node = Neography::Node.create
7
7
  key = generate_text(6)
8
8
  value = generate_text
9
- new_node.add_to_index("node_test_index", key, value)
9
+ new_node.add_to_index("node_test_index", key, value)
10
10
  end
11
11
 
12
12
  it "can add a relationship to an index" do
@@ -17,5 +17,5 @@ describe Neography::Index do
17
17
  value = generate_text
18
18
  r.add_to_index("relationship_test_index", key, value)
19
19
  end
20
-
21
- end
20
+
21
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography do
4
4
  describe "ref_node" do
@@ -7,4 +7,4 @@ describe Neography do
7
7
  root_node.should have_key("self")
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::NodePath do
4
4
 
@@ -219,4 +219,4 @@ describe Neography::NodePath do
219
219
  end
220
220
  end
221
221
  end
222
- end
222
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::NodeRelationship do
4
4
 
@@ -367,8 +367,10 @@ describe Neography::NodeRelationship do
367
367
  p2 = Neography::Node.create
368
368
  new_rel = Neography::Relationship.create(:family, p1, p2)
369
369
  new_rel.del
370
- Neography::Relationship.load(new_rel).should be_nil
370
+ expect {
371
+ Neography::Relationship.load(new_rel)
372
+ }.to raise_error Neography::RelationshipNotFoundException
371
373
  end
372
374
  end
373
375
 
374
- end
376
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Node do
4
4
 
@@ -26,11 +26,11 @@ describe Neography::Node do
26
26
  new_node.age.should == 31
27
27
  end
28
28
 
29
- it "can create a node with more than one property not on the default rest server the other way" do
29
+ it "cannot create a node with more than one property not on the default rest server the other way" do
30
30
  @neo = Neography::Rest.new
31
- new_node = Neography::Node.create(@neo, {"age" => 31, "name" => "Max"})
32
- new_node.name.should == "Max"
33
- new_node.age.should == 31
31
+ expect {
32
+ new_node = Neography::Node.create(@neo, {"age" => 31, "name" => "Max"})
33
+ }.to raise_error(ArgumentError)
34
34
  end
35
35
  end
36
36
 
@@ -44,29 +44,29 @@ describe Neography::Node do
44
44
  existing_node.neo_id.should == new_node.neo_id
45
45
  end
46
46
 
47
- it "returns nil if it tries to load a node that does not exist" do
47
+ it "raises an error if it tries to load a node that does not exist" do
48
48
  new_node = Neography::Node.create
49
49
  fake_node = new_node.neo_id.to_i + 1000
50
- existing_node = Neography::Node.load(fake_node)
51
- existing_node.should be_nil
50
+ expect {
51
+ existing_node = Neography::Node.load(fake_node)
52
+ }.to raise_error Neography::NodeNotFoundException
52
53
  end
53
54
 
54
55
  it "can load a node that exists not on the default rest server" do
55
56
  @neo = Neography::Rest.new
56
- new_node = Neography::Node.create(@neo)
57
+ new_node = Neography::Node.create({}, @neo)
57
58
  existing_node = Neography::Node.load(new_node, @neo)
58
59
  existing_node.should_not be_nil
59
60
  existing_node.neo_id.should_not be_nil
60
61
  existing_node.neo_id.should == new_node.neo_id
61
62
  end
62
63
 
63
- it "can load a node that exists not on the default rest server the other way" do
64
+ it "cannot load a node that exists not on the default rest server the other way" do
64
65
  @neo = Neography::Rest.new
65
- new_node = Neography::Node.create(@neo)
66
- existing_node = Neography::Node.load(@neo, new_node)
67
- existing_node.should_not be_nil
68
- existing_node.neo_id.should_not be_nil
69
- existing_node.neo_id.should == new_node.neo_id
66
+ new_node = Neography::Node.create({}, @neo)
67
+ expect {
68
+ existing_node = Neography::Node.load(@neo, new_node)
69
+ }.to raise_error(ArgumentError)
70
70
  end
71
71
  end
72
72
 
@@ -75,15 +75,16 @@ describe Neography::Node do
75
75
  new_node = Neography::Node.create
76
76
  node_id = new_node.neo_id
77
77
  new_node.del
78
- deleted_node = Neography::Node.load(node_id)
79
- deleted_node.should be_nil
78
+ expect {
79
+ Neography::Node.load(node_id)
80
+ }.to raise_error Neography::NodeNotFoundException
80
81
  end
81
82
  end
82
83
 
83
84
  describe "exists?" do
84
85
  it "can tell if it exists" do
85
86
  new_node = Neography::Node.create
86
- new_node.exist?.should be_true
87
+ new_node.exist?.should be_true
87
88
  end
88
89
 
89
90
  it "can tell if does not exists" do
@@ -221,4 +222,4 @@ describe Neography::Node do
221
222
  end
222
223
 
223
224
 
224
- end
225
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography do
4
4
  subject { Neography::Rest.new }
@@ -10,4 +10,4 @@ describe Neography do
10
10
  node['data']['text'].should == ':1456'
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Relationship do
4
4
  describe "create relationship" do
@@ -34,4 +34,4 @@ describe Neography::Relationship do
34
34
  end
35
35
  end
36
36
 
37
- end
37
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest do
4
4
  before(:each) do
@@ -16,7 +16,7 @@ describe Neography::Rest do
16
16
  batch_result.first.should have_key("from")
17
17
  batch_result.first["body"]["self"].split('/').last.should == new_node[:id]
18
18
  end
19
-
19
+
20
20
  it "can get multiple nodes" do
21
21
  node1 = @neo.create_node
22
22
  node1[:id] = node1["self"].split('/').last
@@ -133,7 +133,7 @@ describe Neography::Rest do
133
133
  batch_result.first["body"]["end"].split('/').last.should == node2["self"].split('/').last
134
134
  batch_result.first["body"]["self"].should == new_relationship["self"]
135
135
  end
136
-
136
+
137
137
  it "can create a single relationship" do
138
138
  node1 = @neo.create_node
139
139
  node2 = @neo.create_node
@@ -205,14 +205,13 @@ describe Neography::Rest do
205
205
  new_node = @neo.create_node
206
206
  key = generate_text(6)
207
207
  value = generate_text
208
- new_index = @neo.get_node_index(index_name, key, value)
209
208
  batch_result = @neo.batch [:add_node_to_index, index_name, key, value, new_node]
210
209
  batch_result.first.should have_key("id")
211
210
  batch_result.first.should have_key("from")
212
- existing_index = @neo.find_node_index(index_name, key, value)
211
+ existing_index = @neo.find_node_index(index_name, key, value)
213
212
  existing_index.should_not be_nil
214
213
  existing_index.first["self"].should == new_node["self"]
215
- @neo.remove_node_from_index(index_name, key, value, new_node)
214
+ @neo.remove_node_from_index(index_name, key, value, new_node)
216
215
  end
217
216
 
218
217
  it "can get a node index" do
@@ -251,7 +250,7 @@ describe Neography::Rest do
251
250
  batch_result.first.should have_key("id")
252
251
  batch_result.first.should have_key("from")
253
252
  batch_result.first["body"]["self"].split('/').last.should == "0"
254
- end
253
+ end
255
254
 
256
255
  it "can batch gremlin with parameters" do
257
256
  new_node = @neo.create_node
@@ -260,14 +259,14 @@ describe Neography::Rest do
260
259
  batch_result.first.should have_key("id")
261
260
  batch_result.first.should have_key("from")
262
261
  batch_result.first["body"]["self"].split('/').last.should == id
263
- end
262
+ end
264
263
 
265
264
  it "can batch cypher" do
266
265
  batch_result = @neo.batch [:execute_query, "start n=node(0) return n"]
267
266
  batch_result.first.should have_key("id")
268
267
  batch_result.first.should have_key("from")
269
268
  batch_result.first["body"]["data"][0][0]["self"].split('/').last.should == "0"
270
- end
269
+ end
271
270
 
272
271
  it "can batch cypher with parameters" do
273
272
  new_node = @neo.create_node
@@ -276,18 +275,20 @@ describe Neography::Rest do
276
275
  batch_result.first.should have_key("id")
277
276
  batch_result.first.should have_key("from")
278
277
  batch_result.first["body"]["data"][0][0]["self"].split('/').last.should == id
279
- end
280
-
278
+ end
279
+
281
280
  it "can delete a node in batch" do
282
-
283
281
  node1 = @neo.create_node
284
282
  node2 = @neo.create_node
285
283
  id1 = node1['self'].split('/').last
286
284
  id2 = node2['self'].split('/').last
287
285
  batch_result = @neo.batch [:delete_node, id1 ], [:delete_node, id2]
288
- @neo.get_node(node1).should be_nil
289
- @neo.get_node(node2).should be_nil
290
-
286
+ expect {
287
+ @neo.get_node(node1).should be_nil
288
+ }.to raise_error Neography::NodeNotFoundException
289
+ expect {
290
+ @neo.get_node(node2).should be_nil
291
+ }.to raise_error Neography::NodeNotFoundException
291
292
  end
292
293
 
293
294
  it "can remove a node from an index in batch " do
@@ -295,16 +296,16 @@ describe Neography::Rest do
295
296
  key = generate_text(6)
296
297
  value1 = generate_text
297
298
  value2 = generate_text
298
- value3 = generate_text
299
-
299
+ value3 = generate_text
300
+
300
301
  node1 = @neo.create_unique_node(index, key, value1, { "name" => "Max" })
301
302
  node2 = @neo.create_unique_node(index, key, value2, { "name" => "Neo" })
302
303
  node3 = @neo.create_unique_node(index, key, value3, { "name" => "Samir"})
303
-
304
+
304
305
  batch_result = @neo.batch [:remove_node_from_index, index, key, value1, node1 ],
305
306
  [:remove_node_from_index, index, key, node2 ],
306
307
  [:remove_node_from_index, index, node3 ]
307
-
308
+
308
309
  @neo.get_node_index(index, key, value1).should be_nil
309
310
  @neo.get_node_index(index, key, value2).should be_nil
310
311
  @neo.get_node_index(index, key, value3).should be_nil
@@ -354,14 +355,13 @@ describe Neography::Rest do
354
355
  it "can add a newly created node to an index" do
355
356
  key = generate_text(6)
356
357
  value = generate_text
357
- new_index = @neo.get_node_index("test_node_index", key, value)
358
358
  batch_result = @neo.batch [:create_node, {"name" => "Max"}], [:add_node_to_index, "test_node_index", key, value, "{0}"]
359
359
  batch_result.first.should have_key("id")
360
360
  batch_result.first.should have_key("from")
361
- existing_index = @neo.find_node_index("test_node_index", key, value)
361
+ existing_index = @neo.find_node_index("test_node_index", key, value)
362
362
  existing_index.should_not be_nil
363
363
  existing_index.first["self"].should == batch_result.first["body"]["self"]
364
- @neo.remove_node_from_index("test_node_index", key, value, batch_result.first["body"]["self"].split('/').last)
364
+ @neo.remove_node_from_index("test_node_index", key, value, batch_result.first["body"]["self"].split('/').last)
365
365
  end
366
366
 
367
367
  it "can add a newly created relationship to an index" do
@@ -398,12 +398,12 @@ describe Neography::Rest do
398
398
  key = generate_text(6)
399
399
  value = generate_text
400
400
 
401
- batch_result = @neo.batch [:create_node, {"name" => "Max"}],
402
- [:create_node, {"name" => "Marc"}],
401
+ batch_result = @neo.batch [:create_node, {"name" => "Max"}],
402
+ [:create_node, {"name" => "Marc"}],
403
403
  [:add_node_to_index, "test_node_index", key, value, "{0}"]
404
404
  [:add_node_to_index, "test_node_index", key, value, "{1}"]
405
- [:create_relationship, "friends", "{0}", "{1}", {:since => "college"}]
406
- [:add_relationship_to_index, "test_relationship_index", key, value, "{4}"]
405
+ [:create_relationship, "friends", "{0}", "{1}", {:since => "college"}]
406
+ [:add_relationship_to_index, "test_relationship_index", key, value, "{4}"]
407
407
  batch_result.should_not be_nil
408
408
  end
409
409
 
@@ -428,7 +428,7 @@ describe Neography::Rest do
428
428
  batch_result = @neo.batch [:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
429
429
  [:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
430
430
  [:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
431
- [:create_relationship, "has", "{0}", "{2}", {}]
431
+ [:create_relationship, "has", "{0}", "{2}", {}]
432
432
  batch_result.should_not be_nil
433
433
 
434
434
 
@@ -442,5 +442,5 @@ describe Neography::Rest do
442
442
  end
443
443
 
444
444
  end
445
-
445
+
446
446
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest do
4
4
  before(:each) do
@@ -103,4 +103,4 @@ describe Neography::Rest do
103
103
 
104
104
  end
105
105
 
106
- end
106
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest do
4
4
  before(:each) do
@@ -19,4 +19,4 @@ describe Neography::Rest do
19
19
  existing_nodes.should_not be_nil
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest do
4
4
  before(:each) do
@@ -43,4 +43,4 @@ describe Neography::Rest do
43
43
  end
44
44
 
45
45
 
46
- end
46
+ end
@@ -1,19 +1,14 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
- describe Neography::Rest do
4
- before(:each) do
5
- @neo = Neography::Rest.new
6
- end
3
+ describe Neography::Connection do
7
4
 
8
5
  it "should not add a content-type header if there's no existing headers" do
9
- @neo.merge_options({}).keys.should == [:parser]
6
+ subject.merge_options({}).keys.should == [:parser]
10
7
  end
11
8
 
12
9
  it "should add a content type if there's existing headers" do
13
- @neo.merge_options({:headers => {'Content-Type' => 'foo/bar'}})[:headers].should ==
10
+ subject.merge_options({:headers => {'Content-Type' => 'foo/bar'}})[:headers].should ==
14
11
  {'Content-Type' => "foo/bar", "User-Agent" => "Neography/#{Neography::VERSION}"}
15
-
16
12
  end
17
13
 
18
-
19
14
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Neography::Rest do
4
4
  before(:each) do
@@ -180,6 +180,26 @@ describe Neography::Rest do
180
180
  @neo.remove_node_from_index("test_node_index", key, value, new_node)
181
181
  end
182
182
 
183
+ it "can get a node index with a space in the value" do
184
+ new_node = @neo.create_node
185
+ key = generate_text(6)
186
+ value = generate_text + " " + generate_text
187
+ @neo.add_node_to_index("test_node_index", key, value, new_node)
188
+ new_index = @neo.get_node_index("test_node_index", key, value)
189
+ new_index.should_not be_nil
190
+ @neo.remove_node_from_index("test_node_index", key, value, new_node)
191
+ end
192
+
193
+ it "can get a node index with a slash in the value" do
194
+ new_node = @neo.create_node
195
+ key = generate_text(6)
196
+ value = generate_text + "/" + generate_text
197
+ @neo.add_node_to_index("test_node_index", key, value, new_node)
198
+ new_index = @neo.get_node_index("test_node_index", key, value)
199
+ new_index.should_not be_nil
200
+ @neo.remove_node_from_index("test_node_index", key, value, new_node)
201
+ end
202
+
183
203
  it "can get a relationship index" do
184
204
  new_node1 = @neo.create_node
185
205
  new_node2 = @neo.create_node