pacer 0.9.1.1-java → 1.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/.autotest +4 -1
  2. data/.gitignore +4 -0
  3. data/.rspec +1 -1
  4. data/Gemfile-dev +33 -0
  5. data/Gemfile-release +4 -0
  6. data/README.md +27 -9
  7. data/Rakefile +26 -8
  8. data/bin/autotest +1 -1
  9. data/lib/pacer/blueprints/multi_graph.rb +7 -19
  10. data/lib/pacer/blueprints/ruby_graph.rb +77 -52
  11. data/lib/pacer/blueprints/tg.rb +6 -93
  12. data/lib/pacer/blueprints.rb +0 -1
  13. data/lib/pacer/core/graph/edges_route.rb +10 -12
  14. data/lib/pacer/core/graph/element_route.rb +14 -21
  15. data/lib/pacer/core/graph/graph_index_route.rb +12 -8
  16. data/lib/pacer/core/graph/graph_route.rb +2 -5
  17. data/lib/pacer/core/graph/mixed_route.rb +3 -5
  18. data/lib/pacer/core/graph/vertices_route.rb +26 -27
  19. data/lib/pacer/core/route.rb +35 -66
  20. data/lib/pacer/exceptions.rb +13 -6
  21. data/lib/pacer/extensions/block_filter_element.rb +0 -5
  22. data/lib/pacer/filter/collection_filter.rb +9 -2
  23. data/lib/pacer/filter/empty_filter.rb +12 -3
  24. data/lib/pacer/filter/future_filter.rb +5 -5
  25. data/lib/pacer/filter/loop_filter.rb +7 -13
  26. data/lib/pacer/filter/object_filter.rb +10 -16
  27. data/lib/pacer/filter/property_filter/filters.rb +134 -93
  28. data/lib/pacer/filter/property_filter.rb +22 -19
  29. data/lib/pacer/filter/where_filter/node_visitor.rb +47 -26
  30. data/lib/pacer/filter/where_filter.rb +24 -3
  31. data/lib/pacer/function_resolver.rb +7 -2
  32. data/lib/pacer/graph/graph_ml.rb +39 -0
  33. data/lib/pacer/graph/graph_transactions_mixin.rb +107 -175
  34. data/lib/pacer/graph/pacer_graph.rb +438 -0
  35. data/lib/pacer/graph/simple_encoder.rb +20 -0
  36. data/lib/pacer/graph/yaml_encoder.rb +81 -0
  37. data/lib/pacer/graph.rb +8 -10
  38. data/lib/pacer/pipe/blackbox_pipeline.rb +11 -4
  39. data/lib/pacer/pipe/block_filter_pipe.rb +5 -22
  40. data/lib/pacer/pipe/cross_product_transform_pipe.rb +5 -7
  41. data/lib/pacer/pipe/edges_pipe.rb +22 -0
  42. data/lib/pacer/pipe/enumerable_pipe.rb +3 -9
  43. data/lib/pacer/pipe/expandable_pipe.rb +2 -14
  44. data/lib/pacer/pipe/id_collection_filter_pipe.rb +2 -8
  45. data/lib/pacer/pipe/is_empty_pipe.rb +5 -12
  46. data/lib/pacer/pipe/is_unique_pipe.rb +3 -13
  47. data/lib/pacer/pipe/label_collection_filter_pipe.rb +1 -7
  48. data/lib/pacer/pipe/label_prefix_pipe.rb +0 -6
  49. data/lib/pacer/pipe/loop_pipe.rb +27 -25
  50. data/lib/pacer/pipe/never_pipe.rb +1 -1
  51. data/lib/pacer/pipe/path_wrapping_pipe.rb +40 -0
  52. data/lib/pacer/pipe/process_pipe.rb +2 -20
  53. data/lib/pacer/pipe/property_comparison_pipe.rb +0 -6
  54. data/lib/pacer/pipe/ruby_pipe.rb +10 -3
  55. data/lib/pacer/pipe/simple_visitor_pipe.rb +12 -11
  56. data/lib/pacer/pipe/stream_sort_pipe.rb +1 -7
  57. data/lib/pacer/pipe/stream_uniq_pipe.rb +0 -6
  58. data/lib/pacer/pipe/type_filter_pipe.rb +1 -7
  59. data/lib/pacer/pipe/unary_transform_pipe.rb +6 -8
  60. data/lib/pacer/pipe/unwrapping_pipe.rb +13 -0
  61. data/lib/pacer/pipe/vertices_pipe.rb +22 -0
  62. data/lib/pacer/pipe/visitor_pipe.rb +3 -7
  63. data/lib/pacer/pipe/wrapping_pipe.rb +37 -0
  64. data/lib/pacer/pipes.rb +17 -12
  65. data/lib/pacer/route/mixin/bulk_operations.rb +8 -9
  66. data/lib/pacer/route/mixin/route_operations.rb +17 -11
  67. data/lib/pacer/route/mixins.rb +0 -1
  68. data/lib/pacer/route.rb +198 -121
  69. data/lib/pacer/side_effect/aggregate.rb +22 -2
  70. data/lib/pacer/side_effect/as.rb +73 -0
  71. data/lib/pacer/side_effect/group_count.rb +0 -3
  72. data/lib/pacer/side_effect/is_unique.rb +7 -6
  73. data/lib/pacer/side_effect.rb +1 -1
  74. data/lib/pacer/support/enumerable.rb +14 -12
  75. data/lib/pacer/support/nil_class.rb +5 -0
  76. data/lib/pacer/support/proc.rb +2 -2
  77. data/lib/pacer/support.rb +1 -1
  78. data/lib/pacer/transform/cap.rb +1 -1
  79. data/lib/pacer/transform/has_count_cap.rb +1 -1
  80. data/lib/pacer/transform/join.rb +20 -16
  81. data/lib/pacer/transform/map.rb +6 -2
  82. data/lib/pacer/transform/path.rb +44 -20
  83. data/lib/pacer/transform/sort_section.rb +58 -51
  84. data/lib/pacer/utils/tsort.rb +7 -2
  85. data/lib/pacer/utils.rb +0 -1
  86. data/lib/pacer/version.rb +4 -3
  87. data/lib/pacer/visitors/section.rb +42 -0
  88. data/lib/pacer/visitors/visits_section.rb +32 -0
  89. data/lib/pacer/visitors.rb +7 -0
  90. data/lib/pacer/wrappers/edge_wrapper.rb +164 -11
  91. data/lib/pacer/wrappers/element_wrapper.rb +133 -8
  92. data/lib/pacer/wrappers/index_wrapper.rb +47 -0
  93. data/lib/pacer/wrappers/vertex_wrapper.rb +175 -12
  94. data/lib/pacer/wrappers/wrapper_selector.rb +40 -0
  95. data/lib/pacer/wrappers/wrapping_pipe_function.rb +90 -0
  96. data/lib/pacer/wrappers.rb +3 -1
  97. data/lib/pacer-1.0.0-standalone.jar +0 -0
  98. data/lib/pacer.rb +13 -47
  99. data/pacer.gemspec +0 -8
  100. data/pom.xml +10 -3
  101. data/spec/pacer/blueprints/dex_spec.rb +12 -26
  102. data/spec/pacer/blueprints/neo4j_spec.rb +14 -28
  103. data/spec/pacer/blueprints/tg_spec.rb +6 -54
  104. data/spec/pacer/core/graph/edges_route_spec.rb +1 -1
  105. data/spec/pacer/core/graph/element_route_spec.rb +2 -2
  106. data/spec/pacer/core/graph/graph_route_spec.rb +2 -2
  107. data/spec/pacer/core/graph/vertices_route_spec.rb +10 -3
  108. data/spec/pacer/core/route_spec.rb +35 -58
  109. data/spec/pacer/filter/empty_filter_spec.rb +5 -6
  110. data/spec/pacer/filter/future_filter_spec.rb +8 -8
  111. data/spec/pacer/filter/loop_filter_spec.rb +120 -6
  112. data/spec/pacer/filter/object_filter_spec.rb +15 -0
  113. data/spec/pacer/filter/property_filter/filters_spec.rb +169 -0
  114. data/spec/pacer/filter/property_filter_spec.rb +15 -12
  115. data/spec/pacer/filter/uniq_filter_spec.rb +1 -1
  116. data/spec/pacer/filter/where_filter_spec.rb +55 -7
  117. data/spec/pacer/graph/{graph_mixin_spec.rb → pacer_graph_spec.rb} +114 -185
  118. data/spec/pacer/route/mixin/base_spec.rb +36 -35
  119. data/spec/pacer/route/mixin/route_operations_spec.rb +4 -46
  120. data/spec/pacer/side_effect/as_spec.rb +34 -0
  121. data/spec/pacer/support/enumerable_spec.rb +6 -6
  122. data/spec/pacer/transform/join_spec.rb +7 -5
  123. data/spec/pacer/transform/map_spec.rb +55 -0
  124. data/spec/pacer/transform/path_spec.rb +30 -15
  125. data/spec/pacer/transform/process_spec.rb +42 -0
  126. data/spec/pacer/transform/sort_section_spec.rb +82 -0
  127. data/spec/pacer/wrapper/edge_wrapper_spec.rb +122 -2
  128. data/spec/pacer/wrapper/element_wrapper_spec.rb +289 -3
  129. data/spec/pacer/wrapper/vertex_wrapper_spec.rb +289 -2
  130. data/spec/spec_helper.rb +16 -7
  131. data/spec/support/graph_runner.rb +80 -29
  132. data/tags +1165 -0
  133. metadata +46 -107
  134. data/.rvmrc +0 -0
  135. data/lib/pacer/blueprints/extensions.rb +0 -77
  136. data/lib/pacer/graph/edge_mixin.rb +0 -127
  137. data/lib/pacer/graph/element_mixin.rb +0 -202
  138. data/lib/pacer/graph/graph_indices_mixin.rb +0 -93
  139. data/lib/pacer/graph/graph_mixin.rb +0 -361
  140. data/lib/pacer/graph/index_mixin.rb +0 -30
  141. data/lib/pacer/graph/vertex_mixin.rb +0 -119
  142. data/lib/pacer/pipe/map_pipe.rb +0 -36
  143. data/lib/pacer/pipe/variable_store_iterator_wrapper.rb +0 -26
  144. data/lib/pacer/route/mixin/variable_route_module.rb +0 -26
  145. data/lib/pacer/side_effect/section.rb +0 -25
  146. data/lib/pacer/support/iterator_mixins.rb +0 -110
  147. data/lib/pacer/wrappers/new_element.rb +0 -106
  148. data/lib/pacer-0.9.1.1-standalone.jar +0 -0
  149. data/spec/pacer/graph/edge_mixin_spec.rb +0 -116
  150. data/spec/pacer/graph/element_mixin_spec.rb +0 -297
  151. data/spec/pacer/graph/index_mixin_spec.rb +0 -0
  152. data/spec/pacer/graph/vertex_mixin_spec.rb +0 -192
@@ -15,7 +15,11 @@ Run.all :read_only do
15
15
  its(:extensions) { should == e_exts }
16
16
 
17
17
  describe 'instance' do
18
- subject { e_wrapper_class.new pangloss_wrote_pacer }
18
+ subject do
19
+ e = e_wrapper_class.new pangloss_wrote_pacer.element
20
+ e.graph = graph
21
+ e
22
+ end
19
23
  it { should_not be_nil }
20
24
  its(:element) { should_not be_nil }
21
25
  it { should == pangloss_wrote_pacer }
@@ -24,10 +28,126 @@ Run.all :read_only do
24
28
  its(:extensions) { should == e_exts }
25
29
 
26
30
  describe 'with more extensions added' do
27
- subject { e_wrapper_class.new(pacer).add_extensions([Pacer::Utils::TSort]) }
31
+ subject { e_wrapper_class.new(pacer.element).add_extensions([Pacer::Utils::TSort]) }
28
32
  its(:class) { should_not == e_wrapper_class }
29
33
  its(:extensions) { should == e_exts + [Pacer::Utils::TSort] }
30
34
  end
31
35
  end
32
36
  end
33
37
  end
38
+
39
+ shared_examples_for Pacer::Wrappers::EdgeWrapper do
40
+ use_simple_graph_data
41
+
42
+ describe '#e' do
43
+ subject { e0.e }
44
+ it { should be_an_edges_route }
45
+ its(:element_type) { should == :edge }
46
+ end
47
+
48
+ describe '#add_extensions' do
49
+ context 'no extensions' do
50
+ subject { e0.add_extensions([]) }
51
+ its('extensions.to_a') { should == [] }
52
+ its(:class) { should == Pacer::Wrappers::EdgeWrapper }
53
+ end
54
+
55
+ context 'with extensions' do
56
+ subject { e0.add_extensions([Tackle::SimpleMixin]) }
57
+ its('extensions.to_a') { should == [Tackle::SimpleMixin] }
58
+ it { should be_a(Pacer::Wrappers::ElementWrapper) }
59
+ it { should be_a(Pacer::Wrappers::EdgeWrapper) }
60
+ it { should_not be_a(Pacer::Wrappers::VertexWrapper) }
61
+
62
+ describe '#e' do
63
+ subject { e0.add_extensions([Tackle::SimpleMixin]).e }
64
+ its('extensions.to_a') { should == [Tackle::SimpleMixin] }
65
+ it { should be_an_edges_route }
66
+ it { should be_a(Tackle::SimpleMixin::Route) }
67
+ end
68
+ end
69
+ end
70
+
71
+ describe '#delete!' do
72
+ before do
73
+ @edge_id = e0.element_id
74
+ e0.delete!
75
+ c = example.metadata[:graph_commit]
76
+ c.call if c
77
+ end
78
+ it 'should be removed' do
79
+ graph.edge(@edge_id).should be_nil
80
+ end
81
+ end
82
+
83
+ contexts(
84
+ 'into new tg' => proc {
85
+ let(:dest) { Pacer.tg }
86
+ },
87
+ 'into graph2' => proc {
88
+ let(:dest) { graph2 }
89
+ }) do
90
+ describe '#clone_into', :transactions => false do
91
+ before { pending 'support temporary hash indices for clone/copy' unless graph.features.supportsIndices }
92
+ context 'including vertices' do
93
+ subject { e0.clone_into(dest, :create_vertices => true) }
94
+
95
+ its('element_id.to_s') { should == e0.element_id.to_s unless graph.features.ignoresSuppliedIds }
96
+ its(:label) { should == 'links' }
97
+ its(:graph) { should equal(dest) }
98
+ its('in_vertex.properties') { should == { 'name' => 'eliza' } }
99
+ its('out_vertex.properties') { should == { 'name' => 'darrick' } }
100
+ end
101
+
102
+ context 'without vertices' do
103
+ subject { e0.clone_into(dest) rescue nil }
104
+ it { should be_nil }
105
+
106
+ context 'but already existing' do
107
+ before do
108
+ v0.clone_into(dest)
109
+ v1.clone_into(dest)
110
+ end
111
+ subject { e0.clone_into(dest) }
112
+ its('element_id.to_s') { should == e0.element_id.to_s unless graph.features.ignoresSuppliedIds }
113
+ its(:label) { should == 'links' }
114
+ its(:graph) { should equal(dest) }
115
+ its('in_vertex.properties') { should == { 'name' => 'eliza' } }
116
+ its('out_vertex.properties') { should == { 'name' => 'darrick' } }
117
+ end
118
+ end
119
+ end
120
+
121
+ describe '#copy_into', :transactions => false do
122
+ before { pending unless graph.features.supportsIndices }
123
+ subject { v0.clone_into(dest); v1.clone_into(dest); e0.copy_into(dest) }
124
+ its(:label) { should == 'links' }
125
+ its(:graph) { should equal(dest) }
126
+ its('in_vertex.properties') { should == { 'name' => 'eliza' } }
127
+ its('out_vertex.properties') { should == { 'name' => 'darrick' } }
128
+ end
129
+
130
+ end
131
+
132
+ subject { e0 }
133
+ its(:graph) { should equal(graph) }
134
+ its(:display_name) { should == "#{ v0.element_id }-links-#{ v1.element_id }" }
135
+ its(:inspect) { should == "#<E[#{ e0.element_id }]:#{ v0.element_id }-links-#{ v1.element_id }>" }
136
+ context 'with label proc' do
137
+ before do
138
+ graph.edge_name = proc { |e| "some name" }
139
+ end
140
+ its(:display_name) { should == "some name" }
141
+ its(:inspect) { should == "#<E[#{ e0.element_id }]:some name>" }
142
+ end
143
+
144
+ context '', :transactions => true do
145
+ it { should_not == e1 }
146
+ it { should == e0 }
147
+ it { should_not == v0 }
148
+ end
149
+ end
150
+
151
+ Run.all do
152
+ it_uses Pacer::Wrappers::EdgeWrapper
153
+ end
@@ -1,11 +1,297 @@
1
1
  require 'spec_helper'
2
- require 'pacer/graph/element_mixin_spec'
3
2
 
3
+ shared_examples_for Pacer::Wrappers::ElementWrapper do
4
+ context 'vertex' do
5
+ subject { v0 }
6
+ it { should be_a(Pacer::Core::Graph::VerticesRoute) }
7
+ it { should be_a(Pacer::Wrappers::ElementWrapper) }
8
+ it { should be_a(Pacer::Wrappers::VertexWrapper) }
9
+ it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
10
+
11
+ describe '#v' do
12
+ context '()' do
13
+ subject { v0.v }
14
+ its(:to_a) { should == [v0] }
15
+ it { should be_a_vertices_route }
16
+ end
17
+
18
+ context '(:name => "eliza")' do
19
+ subject { v0.v(:name => 'eliza') }
20
+ its(:to_a) { should == [v0] }
21
+ it { should be_a_vertices_route }
22
+ end
23
+
24
+ context '(:name => "other")' do
25
+ subject { v0.v(:name => 'other') }
26
+ its(:to_a) { should == [] }
27
+ it { should be_a_vertices_route }
28
+ end
29
+
30
+ context '(SimpleMixin)' do
31
+ subject { v0.v(Tackle::SimpleMixin) }
32
+ its(:to_a) { should == [v0] }
33
+ it { should be_a_vertices_route }
34
+ its(:extensions) { should == [Tackle::SimpleMixin] }
35
+ its(:element_type) { should == :vertex }
36
+ end
37
+ end
38
+
39
+ describe '#e' do
40
+ it 'is unsupported' do
41
+ expect { v0.e }.to raise_error(Pacer::UnsupportedOperation)
42
+ end
43
+ end
44
+
45
+ describe '#eql?' do
46
+ subject { Hash.new(0) }
47
+ before do
48
+ subject[v0] += 1
49
+ subject[graph.v.first] += 1
50
+ end
51
+
52
+ its(:keys) { should == [v0] }
53
+ its(:values) { should == [2] }
54
+
55
+ it 'should put wrapped vertices in the same key' do
56
+ subject[v0.v(Tackle::SimpleMixin).first] += 1
57
+ subject.values.should == [3]
58
+ end
59
+
60
+ it 'should put other vertices in a different key' do
61
+ subject[v1].should == 0
62
+ subject[v0].should == 2
63
+ end
64
+ end
65
+ end
66
+
67
+ context 'edge' do
68
+ subject { e0 }
69
+ it { should be_a(Pacer::Core::Graph::EdgesRoute) }
70
+ it { should be_a(Pacer::Wrappers::ElementWrapper) }
71
+ it { should be_a(Pacer::Wrappers::EdgeWrapper) }
72
+ it { should_not be_a(Pacer::Wrappers::VertexWrapper) }
73
+
74
+ describe '#e', :transactions => false do
75
+ context '()' do
76
+ subject { e0.e }
77
+ its(:to_a) { should == [e0] }
78
+ it(:a => :b) { should be_an_edges_route }
79
+ end
80
+
81
+ context '(:links)' do
82
+ subject { e0.e(:links) }
83
+ its(:to_a) { should == [e0] }
84
+ it { should be_an_edges_route }
85
+ end
86
+
87
+ context '(:other)' do
88
+ subject { e0.e(:other) }
89
+ its(:to_a) { should == [] }
90
+ it { should be_an_edges_route }
91
+ end
92
+
93
+ context '(SimpleMixin)' do
94
+ subject { e0.e(Tackle::SimpleMixin) }
95
+ its(:to_a) { should == [e0] }
96
+ it { should be_an_edges_route }
97
+ its(:extensions) { should == [Tackle::SimpleMixin] }
98
+ end
99
+ end
100
+
101
+ describe '#v' do
102
+ it 'is unsupported' do
103
+ expect { e0.v }.to raise_error(Pacer::UnsupportedOperation)
104
+ end
105
+ end
106
+
107
+ describe '#eql?', :transactions => false do
108
+ subject { Hash.new(0) }
109
+ before do
110
+ subject[e0] += 1
111
+ subject[graph.e.first] += 1
112
+ end
113
+
114
+ its(:keys) { should == [e0] }
115
+ its(:values) { should == [2] }
116
+
117
+ it 'should put wrapped edges in the same key' do
118
+ subject[e0.e(Tackle::SimpleMixin).first] += 1
119
+ subject.values.should == [3]
120
+ end
121
+
122
+ it 'should put other edges in a different key' do
123
+ subject[e1].should == 0
124
+ subject[e0].should == 2
125
+ end
126
+ end
127
+ end
128
+
129
+ describe '#graph' do
130
+ it { v0.graph.should == graph }
131
+ it { e0.graph.should == graph }
132
+ end
133
+
134
+ contexts(
135
+ 'vertex' => proc{
136
+ let(:element) { v0 }
137
+ },
138
+ 'edge' => proc{
139
+ let(:element) { e0 }
140
+ }) do
141
+ describe '#[]' do
142
+ context 'value types' do
143
+ it '(String)' do
144
+ element[:string] = 'words'
145
+ element[:string].should == 'words'
146
+ end
147
+
148
+ it '(Array)' do
149
+ a = [10, 'elements']
150
+ element[:array] = a
151
+ element[:array].should == a
152
+ end
153
+
154
+ it '(Hash)' do
155
+ h = { :elements => 10 }
156
+ element[:hash] = h
157
+ element[:hash].should == h
158
+ end
159
+
160
+ it '(Time)' do
161
+ time = Time.utc 2011, 1, 2, 3, 4, 5
162
+ element[:time] = time
163
+ element[:time].should == time
164
+ end
165
+
166
+ it '(Fixnum)' do
167
+ element[:number] = 123
168
+ element[:number].should == 123
169
+ end
170
+
171
+ it '(Float)' do
172
+ element[:float] = 12.345
173
+ element[:float].should == 12.345
174
+ end
175
+
176
+ it '(Bignum)' do
177
+ element[:big] = 123321123321123321123321123321123321
178
+ element[:big].should == 123321123321123321123321123321123321
179
+ end
180
+
181
+ it "('')" do
182
+ element[:name] = ''
183
+ element[:name].should be_nil
184
+ element.property_keys.should_not include('name')
185
+ end
186
+
187
+ it '(nil)' do
188
+ element[:name] = nil
189
+ element[:name].should be_nil
190
+ element.property_keys.should_not include('name')
191
+ end
192
+ end
193
+
194
+ context 'key types' do
195
+ it 'String' do
196
+ element['name'].should == element[:name]
197
+ end
198
+
199
+ it 'Fixnum' do
200
+ element[123] = 'value'
201
+ element[123].should == 'value'
202
+ end
203
+ end
204
+ end
205
+
206
+ describe '#result', :transactions => false do
207
+ subject { element.result }
208
+ it { should equal(element) }
209
+ end
210
+
211
+ describe '#from_graph?' do
212
+ context 'same graph' do
213
+ subject { element.from_graph? graph }
214
+ it { should be_true }
215
+ end
216
+ context 'different graph' do
217
+ subject { element.from_graph? graph2 }
218
+ it { should be_false }
219
+ end
220
+ end
221
+
222
+ describe '#properties' do
223
+ before do
224
+ element.properties = { :a => 'valuea', :b => 'valueb' }
225
+ end
226
+ subject { element.properties }
227
+ it { should be_a(Hash) }
228
+ its(:count) { should == 2 }
229
+ it 'should have the correct vales' do
230
+ element.properties['a'].should == 'valuea'
231
+ element.properties['b'].should == 'valueb'
232
+ element[:a].should == 'valuea'
233
+ element[:b].should == 'valueb'
234
+ end
235
+ it 'should not affect the element if returned values are changed' do
236
+ element.properties['a'].gsub!(/value/, 'oops')
237
+ element.properties['a'].should == 'valuea'
238
+ element[:a].should == 'valuea'
239
+ end
240
+ it 'should not affect the element if returned keys are changed' do
241
+ element.properties.delete('a')
242
+ element.properties['a'].should == 'valuea'
243
+ element[:a].should == 'valuea'
244
+ end
245
+ it 'should not affect the element if something is added' do
246
+ element.properties['c'] = 'something'
247
+ element[:c].should be_nil
248
+ end
249
+ context 'existing properties' do
250
+ before do
251
+ element.properties = { :a => 'new value', :c => 'value c' }
252
+ end
253
+ its(:count) { should == 2 }
254
+ it 'should have the correct values' do
255
+ element[:a].should == 'new value'
256
+ element[:b].should be_nil
257
+ element[:c].should == 'value c'
258
+ end
259
+ end
260
+ end
261
+
262
+ subject { element }
263
+ its(:element_id) { should_not be_nil }
264
+ #its(:to_a) { should == [element] }
265
+ end
266
+ end
267
+
268
+ Run.all do
269
+ it_uses Pacer::Wrappers::ElementWrapper do
270
+ let(:v0) { graph.create_vertex :name => 'eliza' }
271
+ let(:v1) { graph.create_vertex :name => 'darrick' }
272
+ let(:e0) { graph.create_edge nil, v0, v1, :links }
273
+ let(:e1) { graph.create_edge nil, v0, v1, :relinks }
274
+ end
275
+
276
+ context 'vertex' do
277
+ let(:v0) { graph.create_vertex :name => 'eliza' }
278
+ subject { v0 }
279
+ its(:class) { should == Pacer::Wrappers::VertexWrapper }
280
+ end
281
+
282
+ context 'edge' do
283
+ let(:v0) { graph.create_vertex :name => 'eliza' }
284
+ let(:v1) { graph.create_vertex :name => 'darrick' }
285
+ let(:e0) { graph.create_edge nil, v0, v1, :links }
286
+ subject { e0 }
287
+ its(:class) { should == Pacer::Wrappers::EdgeWrapper }
288
+ end
289
+ end
4
290
  Run.all do
5
291
  # This runs about 500 specs, basically it should test all the ways
6
292
  # that wrappers act the same as native elements
7
- describe Pacer::Wrappers::ElementWrapper do
8
- it_uses Pacer::ElementMixin do
293
+ describe 'wrapped elements' do
294
+ it_uses Pacer::Wrappers::ElementWrapper do
9
295
  let(:v0) { graph.create_vertex(Tackle::SimpleMixin, :name => 'eliza') }
10
296
  let(:v1) { graph.create_vertex(Tackle::SimpleMixin, :name => 'darrick') }
11
297
  let(:e0) { graph.create_edge nil, v0, v1, :links, Tackle::SimpleMixin }