neography 1.3.14 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/neography/rest.rb +29 -472
  3. data/lib/neography/rest/batch.rb +80 -87
  4. data/lib/neography/rest/clean.rb +8 -10
  5. data/lib/neography/rest/constraints.rb +15 -25
  6. data/lib/neography/rest/cypher.rb +2 -6
  7. data/lib/neography/rest/extensions.rb +4 -8
  8. data/lib/neography/rest/gremlin.rb +2 -6
  9. data/lib/neography/rest/helpers.rb +58 -0
  10. data/lib/neography/rest/node_auto_indexes.rb +54 -8
  11. data/lib/neography/rest/node_indexes.rb +92 -17
  12. data/lib/neography/rest/node_labels.rb +15 -26
  13. data/lib/neography/rest/node_paths.rb +8 -16
  14. data/lib/neography/rest/node_properties.rb +45 -4
  15. data/lib/neography/rest/node_relationships.rb +8 -17
  16. data/lib/neography/rest/node_traversal.rb +7 -63
  17. data/lib/neography/rest/nodes.rb +21 -29
  18. data/lib/neography/rest/other_node_relationships.rb +6 -13
  19. data/lib/neography/rest/relationship_auto_indexes.rb +54 -8
  20. data/lib/neography/rest/relationship_indexes.rb +104 -14
  21. data/lib/neography/rest/relationship_properties.rb +45 -4
  22. data/lib/neography/rest/relationship_types.rb +4 -11
  23. data/lib/neography/rest/relationships.rb +6 -13
  24. data/lib/neography/rest/schema_indexes.rb +8 -16
  25. data/lib/neography/rest/spatial.rb +16 -33
  26. data/lib/neography/rest/transactions.rb +25 -26
  27. data/lib/neography/tasks.rb +2 -2
  28. data/lib/neography/version.rb +1 -1
  29. data/spec/unit/rest/batch_spec.rb +49 -50
  30. data/spec/unit/rest/clean_spec.rb +3 -4
  31. data/spec/unit/rest/constraints_spec.rb +12 -13
  32. data/spec/unit/rest/cypher_spec.rb +3 -4
  33. data/spec/unit/rest/extensions_spec.rb +5 -6
  34. data/spec/unit/rest/gremlin_spec.rb +5 -6
  35. data/spec/unit/rest/helpers_spec.rb +124 -0
  36. data/spec/unit/rest/labels_spec.rb +21 -22
  37. data/spec/unit/rest/node_auto_indexes_spec.rb +23 -24
  38. data/spec/unit/rest/node_indexes_spec.rb +42 -43
  39. data/spec/unit/rest/node_paths_spec.rb +10 -13
  40. data/spec/unit/rest/node_properties_spec.rb +22 -23
  41. data/spec/unit/rest/node_relationships_spec.rb +18 -39
  42. data/spec/unit/rest/node_traversal_spec.rb +4 -97
  43. data/spec/unit/rest/nodes_spec.rb +47 -48
  44. data/spec/unit/rest/relationship_auto_indexes_spec.rb +23 -24
  45. data/spec/unit/rest/relationship_indexes_spec.rb +42 -43
  46. data/spec/unit/rest/relationship_properties_spec.rb +22 -23
  47. data/spec/unit/rest/relationship_types_spec.rb +3 -4
  48. data/spec/unit/rest/relationships_spec.rb +5 -6
  49. data/spec/unit/rest/schema_index_spec.rb +7 -8
  50. data/spec/unit/rest/transactions_spec.rb +10 -11
  51. metadata +27 -31
  52. data/lib/neography/rest/auto_indexes.rb +0 -64
  53. data/lib/neography/rest/indexes.rb +0 -102
  54. data/lib/neography/rest/paths.rb +0 -46
  55. data/lib/neography/rest/properties.rb +0 -56
  56. data/spec/unit/rest/paths_spec.rb +0 -69
@@ -4,12 +4,11 @@ module Neography
4
4
  class Rest
5
5
  describe NodeIndexes do
6
6
 
7
- let(:connection) { double(:configuration => "http://configuration") }
8
- subject { NodeIndexes.new(connection) }
7
+ subject { Neography::Rest.new }
9
8
 
10
9
  it "lists all indexes" do
11
- connection.should_receive(:get).with("/index/node")
12
- subject.list
10
+ subject.connection.should_receive(:get).with("/index/node")
11
+ subject.list_node_indexes
13
12
  end
14
13
 
15
14
  it "creates a node index" do
@@ -20,13 +19,13 @@ module Neography
20
19
  },
21
20
  "name" => "some_index"
22
21
  }
23
- connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
24
- subject.create("some_index", "some_type", "some_provider")
22
+ subject.connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
23
+ subject.create_node_index("some_index", "some_type", "some_provider")
25
24
  end
26
25
 
27
26
  it "returns the post result after creation" do
28
- connection.stub(:post).and_return("foo")
29
- subject.create("some_index", "some_type", "some_provider").should == "foo"
27
+ subject.connection.stub(:post).and_return("foo")
28
+ subject.create_node_index("some_index", "some_type", "some_provider").should == "foo"
30
29
  end
31
30
 
32
31
  it "creates an auto-index" do
@@ -37,8 +36,8 @@ module Neography
37
36
  },
38
37
  "name" => "node_auto_index"
39
38
  }
40
- connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
41
- subject.create_auto("some_type", "some_provider")
39
+ subject.connection.should_receive(:post).with("/index/node", json_match(:body, expected_body))
40
+ subject.create_node_auto_index("some_type", "some_provider")
42
41
  end
43
42
 
44
43
  it "creates a unique node in an index" do
@@ -47,8 +46,8 @@ module Neography
47
46
  "key" => "key",
48
47
  "value" => "value"
49
48
  }
50
- connection.should_receive(:post).with("/index/node/some_index?unique", json_match(:body, expected_body))
51
- subject.create_unique("some_index", "key", "value", "properties")
49
+ subject.connection.should_receive(:post).with("/index/node/some_index?unique", json_match(:body, expected_body))
50
+ subject.create_unique_node("some_index", "key", "value", "properties")
52
51
  end
53
52
 
54
53
  it "gets or creates a unique node in an index" do
@@ -57,83 +56,83 @@ module Neography
57
56
  "key" => "key",
58
57
  "value" => "value"
59
58
  }
60
- connection.should_receive(:post).with("/index/node/some_index?uniqueness=get_or_create", json_match(:body, expected_body))
61
- subject.get_or_create_unique("some_index", "key", "value", "properties")
59
+ subject.connection.should_receive(:post).with("/index/node/some_index?uniqueness=get_or_create", json_match(:body, expected_body))
60
+ subject.get_or_create_unique_node("some_index", "key", "value", "properties")
62
61
  end
63
62
 
64
63
  it "adds a node to an index" do
65
64
  expected_body = {
66
- "uri" => "http://configuration/node/42",
65
+ "uri" => "http://localhost:7474/node/42",
67
66
  "key" => "key",
68
67
  "value" => "value"
69
68
  }
70
- connection.should_receive(:post).with("/index/node/some_index", json_match(:body, expected_body))
71
- subject.add("some_index", "key", "value", "42")
69
+ subject.connection.should_receive(:post).with("/index/node/some_index", json_match(:body, expected_body))
70
+ subject.add_node_to_index("some_index", "key", "value", "42")
72
71
  end
73
72
 
74
73
  it "gets a node from an index" do
75
- connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
76
- subject.get("some_index", "some_key", "some_value")
74
+ subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
75
+ subject.get_node_index("some_index", "some_key", "some_value")
77
76
  end
78
77
 
79
78
  it "returns nil if nothing was found in the index" do
80
- connection.stub(:get).and_return(nil)
81
- subject.get("some_index", "some_key", "some_value").should be_nil
79
+ subject.connection.stub(:get).and_return(nil)
80
+ subject.get_node_index("some_index", "some_key", "some_value").should be_nil
82
81
  end
83
82
 
84
83
  it "finds by key and value if both passed to #find" do
85
- connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
86
- subject.find("some_index", "some_key", "some_value")
84
+ subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
85
+ subject.find_node_index("some_index", "some_key", "some_value")
87
86
  end
88
87
 
89
88
  it "finds by query if no value passed to #find" do
90
- connection.should_receive(:get).with("/index/node/some_index?query=some_query")
91
- subject.find("some_index", "some_query")
89
+ subject.connection.should_receive(:get).with("/index/node/some_index?query=some_query")
90
+ subject.find_node_index("some_index", "some_query")
92
91
  end
93
92
 
94
93
  it "finds by key and value" do
95
- connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
96
- subject.find_by_key_value("some_index", "some_key", "some_value")
94
+ subject.connection.should_receive(:get).with("/index/node/some_index/some_key/some_value")
95
+ subject.find_node_index_by_key_value("some_index", "some_key", "some_value")
97
96
  end
98
97
 
99
98
  it "finds by query" do
100
- connection.should_receive(:get).with("/index/node/some_index?query=some_query")
101
- subject.find_by_query("some_index", "some_query")
99
+ subject.connection.should_receive(:get).with("/index/node/some_index?query=some_query")
100
+ subject.find_node_index_by_query("some_index", "some_query")
102
101
  end
103
102
 
104
103
  it "removes a node from an index by id for #remove with two arguments" do
105
- connection.should_receive(:delete).with("/index/node/some_index/42")
106
- subject.remove("some_index", "42")
104
+ subject.connection.should_receive(:delete).with("/index/node/some_index/42")
105
+ subject.remove_node_from_index("some_index", "42")
107
106
  end
108
107
 
109
108
  it "removes a node from an index by key for #remove with three arguments" do
110
- connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
111
- subject.remove("some_index", "some_key", "42")
109
+ subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
110
+ subject.remove_node_from_index("some_index", "some_key", "42")
112
111
  end
113
112
 
114
113
  it "removes a node from an index by key and value for #remove with four arguments" do
115
- connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
116
- subject.remove("some_index", "some_key", "some_value", "42")
114
+ subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
115
+ subject.remove_node_from_index("some_index", "some_key", "some_value", "42")
117
116
  end
118
117
 
119
118
  it "removes a node from an index" do
120
- connection.should_receive(:delete).with("/index/node/some_index/42")
121
- subject.remove_by_id("some_index", "42")
119
+ subject.connection.should_receive(:delete).with("/index/node/some_index/42")
120
+ subject.remove_node_index_by_id("some_index", "42")
122
121
  end
123
122
 
124
123
  it "removes a node from an index by key" do
125
- connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
126
- subject.remove_by_key("some_index", "42", "some_key")
124
+ subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/42")
125
+ subject.remove_node_index_by_key("some_index", "42", "some_key")
127
126
  end
128
127
 
129
128
  it "removes a node from an index by key and value" do
130
- connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
131
- subject.remove_by_value("some_index", "42", "some_key", "some_value")
129
+ subject.connection.should_receive(:delete).with("/index/node/some_index/some_key/some_value/42")
130
+ subject.remove_node_index_by_value("some_index", "42", "some_key", "some_value")
132
131
  end
133
132
 
134
133
  it "drops an index" do
135
- connection.should_receive(:delete).with("/index/node/some_index")
136
- subject.drop("some_index")
134
+ subject.connection.should_receive(:delete).with("/index/node/some_index")
135
+ subject.drop_node_index("some_index")
137
136
  end
138
137
 
139
138
  end
@@ -4,53 +4,50 @@ module Neography
4
4
  class Rest
5
5
  describe NodePaths do
6
6
 
7
- let(:connection) { double(:configuration => "http://configuration") }
8
- subject { NodePaths.new(connection) }
7
+ subject { Neography::Rest.new }
9
8
 
10
9
  it "gets a shortest path between two nodes" do
11
10
  expected_body = {
12
- "to" => "http://configuration/node/43",
11
+ "to" => "http://localhost:7474/node/43",
13
12
  "relationships" => "relationships",
14
13
  "max_depth" => 3,
15
14
  "algorithm" => "shortestPath"
16
15
  }
17
16
 
18
- connection.should_receive(:post).with("/node/42/path", json_match(:body, expected_body))
17
+ subject.connection.should_receive(:post).with("/node/42/path", json_match(:body, expected_body))
19
18
 
20
- subject.get("42", "43", "relationships", 3, "shortestPath")
19
+ subject.get_path("42", "43", "relationships", 3, "shortestPath")
21
20
  end
22
21
 
23
22
  it "gets all shortest paths between two nodes" do
24
23
  expected_body = {
25
- "to" => "http://configuration/node/43",
24
+ "to" => "http://localhost:7474/node/43",
26
25
  "relationships" => "relationships",
27
26
  "max_depth" => 3,
28
27
  "algorithm" => "shortestPath"
29
28
  }
30
29
 
31
- connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
30
+ subject.connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
32
31
 
33
- subject.get_all("42", "43", "relationships", 3, "shortestPath")
32
+ subject.get_paths("42", "43", "relationships", 3, "shortestPath")
34
33
  end
35
34
 
36
35
  it "gets all shortest weighted paths between two nodes" do
37
36
  expected_body = {
38
- "to" => "http://configuration/node/43",
37
+ "to" => "http://localhost:7474/node/43",
39
38
  "relationships" => "relationships",
40
39
  "cost_property" => "cost",
41
40
  "max_depth" => 3,
42
41
  "algorithm" => "shortestPath"
43
42
  }
44
43
 
45
- connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
44
+ subject.connection.should_receive(:post).with("/node/42/paths", json_match(:body, expected_body))
46
45
 
47
- subject.shortest_weighted("42", "43", "relationships", "cost", 3, "shortestPath")
46
+ subject.get_shortest_weighted_path("42", "43", "relationships", "cost", 3, "shortestPath")
48
47
  end
49
48
 
50
49
  context "algorithm" do
51
50
 
52
- subject { NodePaths.new(nil) }
53
-
54
51
  [ :shortest, "shortest", :shortestPath, "shortestPath", :short, "short" ].each do |algorithm|
55
52
  it "parses shortestPath" do
56
53
  subject.send(:get_algorithm, algorithm).should == "shortestPath"
@@ -4,8 +4,7 @@ module Neography
4
4
  class Rest
5
5
  describe NodeProperties do
6
6
 
7
- let(:connection) { double }
8
- subject { NodeProperties.new(connection) }
7
+ subject { Neography::Rest.new }
9
8
 
10
9
  it "sets properties" do
11
10
  options1 = {
@@ -16,9 +15,9 @@ module Neography
16
15
  :body => '"qux"',
17
16
  :headers => json_content_type
18
17
  }
19
- connection.should_receive(:put).with("/node/42/properties/foo", options1)
20
- connection.should_receive(:put).with("/node/42/properties/baz", options2)
21
- subject.set("42", {:foo => "bar", :baz => "qux"})
18
+ subject.connection.should_receive(:put).with("/node/42/properties/foo", options1)
19
+ subject.connection.should_receive(:put).with("/node/42/properties/baz", options2)
20
+ subject.set_node_properties("42", {:foo => "bar", :baz => "qux"})
22
21
  end
23
22
 
24
23
  it "resets properties" do
@@ -26,36 +25,36 @@ module Neography
26
25
  :body => '{"foo":"bar"}',
27
26
  :headers => json_content_type
28
27
  }
29
- connection.should_receive(:put).with("/node/42/properties", options)
30
- subject.reset("42", {:foo => "bar"})
28
+ subject.connection.should_receive(:put).with("/node/42/properties", options)
29
+ subject.reset_node_properties("42", {:foo => "bar"})
31
30
  end
32
31
 
33
32
  context "getting properties" do
34
33
 
35
34
  it "gets all properties" do
36
- connection.should_receive(:get).with("/node/42/properties")
37
- subject.get("42")
35
+ subject.connection.should_receive(:get).with("/node/42/properties")
36
+ subject.get_node_properties("42")
38
37
  end
39
38
 
40
39
  it "gets multiple properties" do
41
- connection.should_receive(:get).with("/node/42/properties/foo")
42
- connection.should_receive(:get).with("/node/42/properties/bar")
43
- subject.get("42", "foo", "bar")
40
+ subject.connection.should_receive(:get).with("/node/42/properties/foo")
41
+ subject.connection.should_receive(:get).with("/node/42/properties/bar")
42
+ subject.get_node_properties("42", "foo", "bar")
44
43
  end
45
44
 
46
45
  it "returns multiple properties as a hash" do
47
- connection.stub(:get).and_return("baz", "qux")
48
- subject.get("42", "foo", "bar").should == { "foo" => "baz", "bar" => "qux" }
46
+ subject.connection.stub(:get).and_return("baz", "qux")
47
+ subject.get_node_properties("42", "foo", "bar").should == { "foo" => "baz", "bar" => "qux" }
49
48
  end
50
49
 
51
50
  it "returns nil if no properties were found" do
52
- connection.stub(:get).and_return(nil, nil)
53
- subject.get("42", "foo", "bar").should be_nil
51
+ subject.connection.stub(:get).and_return(nil, nil)
52
+ subject.get_node_properties("42", "foo", "bar").should be_nil
54
53
  end
55
54
 
56
55
  it "returns hash without nil return values" do
57
- connection.stub(:get).and_return("baz", nil)
58
- subject.get("42", "foo", "bar").should == { "foo" => "baz" }
56
+ subject.connection.stub(:get).and_return("baz", nil)
57
+ subject.get_node_properties("42", "foo", "bar").should == { "foo" => "baz" }
59
58
  end
60
59
 
61
60
  end
@@ -63,14 +62,14 @@ module Neography
63
62
  context "removing properties" do
64
63
 
65
64
  it "removes all properties" do
66
- connection.should_receive(:delete).with("/node/42/properties")
67
- subject.remove("42")
65
+ subject.connection.should_receive(:delete).with("/node/42/properties")
66
+ subject.remove_node_properties("42")
68
67
  end
69
68
 
70
69
  it "removes multiple properties" do
71
- connection.should_receive(:delete).with("/node/42/properties/foo")
72
- connection.should_receive(:delete).with("/node/42/properties/bar")
73
- subject.remove("42", "foo", "bar")
70
+ subject.connection.should_receive(:delete).with("/node/42/properties/foo")
71
+ subject.connection.should_receive(:delete).with("/node/42/properties/bar")
72
+ subject.remove_node_properties("42", "foo", "bar")
74
73
  end
75
74
 
76
75
  end
@@ -4,73 +4,52 @@ module Neography
4
4
  class Rest
5
5
  describe NodeRelationships do
6
6
 
7
- let(:connection) { double(:configuration => "http://configuration") }
8
- subject { NodeRelationships.new(connection) }
7
+ subject { Neography::Rest.new }
9
8
 
10
9
  it "creates a relationship" do
11
10
  body_hash = { "type" => "some_type",
12
- "to" => "http://configuration/node/43",
11
+ "to" => "http://localhost:7474/node/43",
13
12
  "data" => {"foo"=>"bar","baz"=>"qux"}
14
13
  }
15
- connection.should_receive(:post).with("/node/42/relationships", json_match(:body, body_hash))
14
+ subject.connection.should_receive(:post).with("/node/42/relationships", json_match(:body, body_hash))
16
15
 
17
- subject.create("some_type", "42", "43", {:foo => "bar", :baz => "qux"})
16
+ subject.create_relationship("some_type", "42", "43", {:foo => "bar", :baz => "qux"})
18
17
  end
19
18
 
20
19
  it "returns the post results" do
21
- connection.stub(:post).and_return("foo")
20
+ subject.connection.stub(:post).and_return("foo")
22
21
 
23
- subject.create("some_type", "42", "43", {}).should == "foo"
22
+ subject.create_relationship("some_type", "42", "43", {}).should == "foo"
24
23
  end
25
24
 
26
25
  it "gets relationships" do
27
- connection.should_receive(:get).with("/node/42/relationships/all")
28
- subject.get("42")
26
+ subject.connection.should_receive(:get).with("/node/42/relationships/all")
27
+ subject.get_node_relationships("42")
29
28
  end
30
29
 
31
30
  it "gets relationships with direction" do
32
- connection.should_receive(:get).with("/node/42/relationships/in")
33
- subject.get("42", :in)
31
+ subject.connection.should_receive(:get).with("/node/42/relationships/in")
32
+ subject.get_node_relationships("42", :in)
34
33
  end
35
34
 
36
35
  it "gets relationships with direction and type" do
37
- connection.should_receive(:get).with("/node/42/relationships/in/foo")
38
- subject.get("42", :in, "foo")
36
+ subject.connection.should_receive(:get).with("/node/42/relationships/in/foo")
37
+ subject.get_node_relationships("42", :in, "foo")
39
38
  end
40
39
 
41
40
  it "gets relationships with direction and types" do
42
- connection.should_receive(:get).with("/node/42/relationships/in/foo%26bar")
43
- subject.get("42", :in, ["foo", "bar"])
41
+ subject.connection.should_receive(:get).with("/node/42/relationships/in/foo%26bar")
42
+ subject.get_node_relationships("42", :in, ["foo", "bar"])
44
43
  end
45
44
 
46
45
  it "returns empty array if no relationships were found" do
47
- connection.stub(:get).and_return([])
48
- subject.get("42", :in).should be_empty
46
+ subject.connection.stub(:get).and_return([])
47
+ subject.get_node_relationships("42", :in).should be_empty
49
48
  end
50
49
 
51
50
  it "returns empty array if no relationships were found by type" do
52
- connection.stub(:get).and_return([])
53
- subject.get("42", :in, "foo")
54
- end
55
-
56
- context "directions" do
57
-
58
- [ :incoming, "incoming", :in, "in" ].each do |direction|
59
- it "parses 'in' direction" do
60
- NodeRelationships.new(nil).parse_direction(direction).should == "in"
61
- end
62
- end
63
-
64
- [ :outgoing, "outgoing", :out, "out" ].each do |direction|
65
- it "parses 'out' direction" do
66
- NodeRelationships.new(nil).parse_direction(direction).should == "out"
67
- end
68
- end
69
-
70
- it "parses 'all' direction by default" do
71
- NodeRelationships.new(nil).parse_direction("foo").should == "all"
72
- end
73
-
51
+ subject.connection.stub(:get).and_return([])
52
+ subject.get_node_relationships("42", :in, "foo")
74
53
  end
75
54
 
76
55
  end
@@ -4,9 +4,8 @@ module Neography
4
4
  class Rest
5
5
  describe NodeTraversal do
6
6
 
7
- let(:connection) { double }
8
- subject { NodeTraversal.new(connection) }
9
-
7
+ subject { Neography::Rest.new }
8
+
10
9
  it "traverses" do
11
10
  description = {
12
11
  "order" => :breadth,
@@ -26,102 +25,10 @@ module Neography
26
25
  "max_depth" => 4
27
26
  }
28
27
 
29
- connection.should_receive(:post).with("/node/42/traverse/relationship", json_match(:body, expected_body))
28
+ subject.connection.should_receive(:post).with("/node/42/traverse/relationship", json_match(:body, expected_body))
30
29
 
31
30
  subject.traverse("42", :relationship, description)
32
- end
33
-
34
- context "options" do
35
- let(:traversal) { NodeTraversal.new(nil) }
36
-
37
- context "order" do
38
- [ :breadth, "breadth", "breadth first", "breadthFirst", :wide, "wide" ].each do |order|
39
- it "parses breadth first" do
40
- subject.send(:get_order, order).should == "breadth first"
41
- end
42
- end
43
-
44
- it "parses depth first by default" do
45
- subject.send(:get_order, "foo").should == "depth first"
46
- end
47
- end
48
-
49
- context "uniqueness" do
50
- [ :nodeglobal, "node global", "nodeglobal", "node_global" ].each do |order|
51
- it "parses node global" do
52
- subject.send(:get_uniqueness, order).should == "node global"
53
- end
54
- end
55
-
56
- [ :nodepath, "node path", "nodepath", "node_path" ].each do |order|
57
- it "parses node path" do
58
- subject.send(:get_uniqueness, order).should == "node path"
59
- end
60
- end
61
-
62
- [ :noderecent, "node recent", "noderecent", "node_recent" ].each do |order|
63
- it "parses node recent" do
64
- subject.send(:get_uniqueness, order).should == "node recent"
65
- end
66
- end
67
-
68
- [ :relationshipglobal, "relationship global", "relationshipglobal", "relationship_global" ].each do |order|
69
- it "parses relationship global" do
70
- subject.send(:get_uniqueness, order).should == "relationship global"
71
- end
72
- end
73
-
74
- [ :relationshippath, "relationship path", "relationshippath", "relationship_path" ].each do |order|
75
- it "parses relationship path" do
76
- subject.send(:get_uniqueness, order).should == "relationship path"
77
- end
78
- end
79
-
80
- [ :relationshiprecent, "relationship recent", "relationshiprecent", "relationship_recent" ].each do |order|
81
- it "parses relationship recent" do
82
- subject.send(:get_uniqueness, order).should == "relationship recent"
83
- end
84
- end
85
-
86
- it "parses none by default" do
87
- subject.send(:get_uniqueness, "foo").should == "none"
88
- end
89
- end
90
-
91
- context "depth" do
92
- it "parses nil as nil" do
93
- subject.send(:get_depth, nil).should be_nil
94
- end
95
- it "parses 0 as 1" do
96
- subject.send(:get_depth, "0").should == 1
97
- end
98
- it "parses integers" do
99
- subject.send(:get_depth, "42").should == 42
100
- end
101
- end
102
-
103
- context "type" do
104
- [ :relationship, "relationship", :relationships, "relationships" ].each do |type|
105
- it "parses relationship" do
106
- subject.send(:get_type, type).should == "relationship"
107
- end
108
- end
109
- [ :path, "path", :paths, "paths" ].each do |type|
110
- it "parses path" do
111
- subject.send(:get_type, type).should == "path"
112
- end
113
- end
114
- [ :fullpath, "fullpath", :fullpaths, "fullpaths" ].each do |type|
115
- it "parses fullpath" do
116
- subject.send(:get_type, type).should == "fullpath"
117
- end
118
- end
119
-
120
- it "parses node by default" do
121
- subject.send(:get_type, "foo").should == "node"
122
- end
123
- end
124
- end
31
+ end
125
32
 
126
33
  end
127
34
  end