pacer 2.0.13-java → 2.0.14-java

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13555fbf36509b247945a23559f60d2b5eddb0e4
4
- data.tar.gz: 258b4dd295d67b91dfbb8aa29969b7bef809fb2b
3
+ metadata.gz: 516ac17e78965aa3d2e83cd8abcdd698a6a65df2
4
+ data.tar.gz: 42d4eec909e091059251f379296f5b4c118f008f
5
5
  SHA512:
6
- metadata.gz: 7ed67f63063e560b02926a116fcace7dd285d7522d2f8165ccc659b34df9a66756c6bb31013e37a540844781a58fad4ebb6a2eb99dbec68ab772ed9d75e341a2
7
- data.tar.gz: d1b69243930b7906702a5c67f5b2359b2dbf9f3b61bcf26c68a3b8bfe9b2cf51ab0a060277c9a13faee0efc5732279e9f70ba15a647e384f021ada7603bf2bdf
6
+ metadata.gz: 1e2ed8eb71d0e19d61adc9e324b6405c75b0aa710944f4e4fa41e542075673584ec63f618149c93f973325a8bc5b04ff8751b4e19de3fe457a65e61e745e5e1d
7
+ data.tar.gz: 6c6ecde3e79970241e660108de1bb4bdb8055df7f94a84a152902273ed4f36521e7dd861e98510875b5de4cc95088e691a49f12b04a84f257e3316ecb28d6266
@@ -9,7 +9,7 @@ module Pacer::Core::Graph
9
9
  # @yield [ElementWrapper] filter proc, see {Pacer::Route#property_filter}
10
10
  # @return [ElementRoute] the same type and extensions as the source route.
11
11
  def filter(*filters, &block)
12
- Pacer::Route.property_filter(self, filters, block)
12
+ Pacer::Route.property_filter(self, filters, block, true)
13
13
  end
14
14
 
15
15
  # v is undefined for edge routes.
@@ -9,7 +9,7 @@ module Pacer::Core::Graph
9
9
  route = chain_route :element_type => :vertex,
10
10
  :pipe_class => Pacer::Pipes::VerticesPipe,
11
11
  :route_name => 'GraphV'
12
- Pacer::Route.property_filter(route, filters, block)
12
+ Pacer::Route.property_filter(route, filters, block, true)
13
13
  end
14
14
 
15
15
  # Returns a new route to all graph edges. Standard filter options.
@@ -18,7 +18,7 @@ module Pacer::Core::Graph
18
18
  route = chain_route :element_type => :edge,
19
19
  :pipe_class => Pacer::Pipes::EdgesPipe,
20
20
  :route_name => 'GraphE'
21
- Pacer::Route.property_filter(route, filters, block)
21
+ Pacer::Route.property_filter(route, filters, block, true)
22
22
  end
23
23
 
24
24
  def filter(*args)
@@ -10,7 +10,7 @@ module Pacer::Core::Graph
10
10
  :pipe_args => Pacer::Vertex,
11
11
  :wrapper => wrapper,
12
12
  :extensions => extensions
13
- Pacer::Route.property_filter(route, args, block)
13
+ Pacer::Route.property_filter(route, args, block, true)
14
14
  end
15
15
 
16
16
  # Pass through only edges.
@@ -20,7 +20,7 @@ module Pacer::Core::Graph
20
20
  :pipe_args => Pacer::Edge,
21
21
  :wrapper => wrapper,
22
22
  :extensions => extensions
23
- Pacer::Route.property_filter(route, args, block)
23
+ Pacer::Route.property_filter(route, args, block, true)
24
24
  end
25
25
 
26
26
  def filter(*args, &block)
@@ -29,7 +29,7 @@ module Pacer::Core::Graph
29
29
 
30
30
  def mixed(*args, &block)
31
31
  route = chain_route :pipe_class => Pacer::Pipes::IdentityPipe
32
- Pacer::Route.property_filter(route, args, block)
32
+ Pacer::Route.property_filter(route, args, block, true)
33
33
  end
34
34
 
35
35
  # Out edges from matching vertices.
@@ -28,21 +28,9 @@ module Pacer
28
28
  filters.is_a? Pacer::Filter::PropertyFilter::Filters
29
29
  end
30
30
 
31
- def property_filter_before(base, args, block)
32
- filters = Pacer::Route.edge_filters(base.graph, args)
33
- filters.blocks = [block] if block
34
- args = chain_args(filters)
35
- if filters.extensions_only? and base.is_a? Route
36
- yield base.chain_route(args)
37
- elsif filters and filters.any?
38
- yield base.chain_route(args.merge!(filter: :property, filters: filters))
39
- else
40
- yield base
41
- end
42
- end
43
-
44
- def property_filter(base, args, block)
31
+ def property_filter(base, args, block, strict = false)
45
32
  filters = Pacer::Route.edge_filters(base.graph, args)
33
+ filters.use_lookup! if strict
46
34
  filters.blocks = [block] if block
47
35
  args = chain_args(filters)
48
36
  if filters.extensions_only? and base.is_a? Route
data/lib/pacer/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Pacer
2
- VERSION = "2.0.13"
2
+ VERSION = "2.0.14"
3
3
  # Clients may optionally define the following constants in the Pacer namespace:
4
4
  # - LOAD_JARS : set to false to manage jar loading in the client. Be sure to load the jars defined in JARFILES.
5
5
  # - LOCKJAR_LOCK_OPTS : set some options to be passed to LockJar.lock (ie. :lockfile, :download_artifacts, :local_repo)
@@ -7,6 +7,12 @@ module Neo2Spec
7
7
  end
8
8
  end
9
9
 
10
+ class FastPerson < Pacer::Wrappers::VertexWrapper
11
+ def self.route_conditions(graph)
12
+ { type: 'person' }
13
+ end
14
+ end
15
+
10
16
  class Frog < Pacer::Wrappers::VertexWrapper
11
17
  def self.route_conditions(graph)
12
18
  { frog: 'yes' }
@@ -48,6 +54,18 @@ module Neo2Spec
48
54
  its(:wrapper) { should == Person }
49
55
  end
50
56
 
57
+ describe FastPerson do
58
+ subject { graph2.v(FastPerson) }
59
+
60
+ # sanity checks
61
+ it { should be_a Pacer::Filter::LuceneFilter }
62
+ its(:query) { should == 'type:"person"' }
63
+ # This doesn't work because neo indices are out of sync before the transaction finalizes
64
+ #its(:count) { should == 2 }
65
+
66
+ its(:wrapper) { should == FastPerson }
67
+ end
68
+
51
69
  describe Frog do
52
70
  subject { graph2.v(Frog) }
53
71
 
@@ -7,6 +7,12 @@ module NeoSpec
7
7
  end
8
8
  end
9
9
 
10
+ class FastPerson < Pacer::Wrappers::VertexWrapper
11
+ def self.lookup(graph)
12
+ { type: 'person' }
13
+ end
14
+ end
15
+
10
16
  class Frog < Pacer::Wrappers::VertexWrapper
11
17
  def self.route_conditions(graph)
12
18
  { frog: 'yes' }
@@ -48,6 +54,18 @@ module NeoSpec
48
54
  its(:wrapper) { should == Person }
49
55
  end
50
56
 
57
+ describe FastPerson do
58
+ subject { graph2.v(FastPerson) }
59
+
60
+ # sanity checks
61
+ it { should be_a Pacer::Filter::LuceneFilter }
62
+ its(:query) { should == 'type:"person"' }
63
+ # This doesn't work because neo indices are out of sync before the transaction finalizes
64
+ #its(:count) { should == 2 }
65
+
66
+ its(:wrapper) { should == FastPerson }
67
+ end
68
+
51
69
  describe Frog do
52
70
  subject { graph2.v(Frog) }
53
71
 
@@ -1,39 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- Run.all :read_only do
4
- use_pacer_graphml_data :read_only
5
-
6
- describe Pacer::Wrappers::VertexWrapper do
7
-
8
- let(:v_exts) { [Tackle::SimpleMixin, TP::Project] }
9
- let(:v_wrapper_class) { Pacer::Wrappers::VertexWrapper.wrapper_for v_exts }
10
-
11
- subject { v_wrapper_class }
12
-
13
- it { should_not be_nil }
14
- it { subject.route_conditions(graph).should == { type: 'project' } }
15
- its(:extensions) { should == v_exts }
16
-
17
- describe 'instance' do
18
- subject do
19
- v_wrapper_class.new graph, pacer.element
20
- end
21
- it { should_not be_nil }
22
- its(:element) { should_not be_nil }
23
- it { should == pacer }
24
- it { should_not equal pacer }
25
- its(:element_id) { should == pacer.element_id }
26
- its(:extensions) { should == v_exts }
27
-
28
- describe 'with more extensions added' do
29
- subject { v_wrapper_class.new(graph, pacer.element).add_extensions([Pacer::Utils::TSort]) }
30
- its(:class) { should_not == v_wrapper_class }
31
- its(:extensions) { should == v_exts + [Pacer::Utils::TSort] }
32
- end
33
- end
34
- end
35
- end
36
-
37
3
  module VertexWrapperSpec
38
4
  module Project
39
5
  def self.route_conditions(graph)
@@ -45,277 +11,361 @@ module VertexWrapperSpec
45
11
  end
46
12
 
47
13
  module IsRuby
48
- def self.route_conditions(graph)
14
+ def self.lookup(graph)
49
15
  { :language => 'ruby' }
50
16
  end
51
17
 
52
18
  module Vertex
53
19
  end
54
20
  end
55
- end
56
21
 
57
- shared_examples_for Pacer::Wrappers::VertexWrapper do
58
- use_simple_graph_data
22
+ Run.all :read_only do
23
+ use_pacer_graphml_data :read_only
59
24
 
60
- describe '#v' do
61
- subject { v0.v }
62
- it { should be_a_vertices_route }
63
- its(:element_type) { should == :vertex }
64
- end
25
+ describe Pacer::Wrappers::VertexWrapper do
65
26
 
66
- describe '#add_extensions' do
67
- context 'no extensions' do
68
- subject { v0.add_extensions([]) }
69
- its('extensions.to_a') { should == [] }
70
- its(:class) { should == graph.base_vertex_wrapper }
71
- end
27
+ let(:v_exts) { [Tackle::SimpleMixin, TP::Project] }
28
+ let(:v_wrapper_class) { Pacer::Wrappers::VertexWrapper.wrapper_for v_exts }
72
29
 
73
- context 'with extensions' do
74
- subject { v0.add_extensions([Tackle::SimpleMixin]) }
75
- its('extensions.to_a') { should == [Tackle::SimpleMixin] }
76
- it { should be_a(Pacer::Wrappers::ElementWrapper) }
77
- it { should be_a(Pacer::Wrappers::VertexWrapper) }
78
- it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
30
+ subject { v_wrapper_class }
79
31
 
80
- describe '#v' do
81
- subject { v0.add_extensions([Tackle::SimpleMixin]).v }
82
- its('extensions.to_a') { should == [Tackle::SimpleMixin] }
83
- it { should be_a_vertices_route }
84
- it { should be_a(Tackle::SimpleMixin::Route) }
85
- end
86
- end
87
- end
32
+ it { should_not be_nil }
33
+ it { subject.route_conditions(graph).should == { type: 'project' } }
34
+ its(:extensions) { should == v_exts }
88
35
 
89
- describe '#as?' do
90
- let(:v) { graph.create_vertex type: 'project' }
91
- context 'Project' do
92
- subject { v.as?(VertexWrapperSpec::Project) }
93
- it { should be_true }
94
- end
95
- context 'IsRuby' do
96
- subject { v.as?(VertexWrapperSpec::IsRuby) }
97
- it { should_not be_true }
98
- end
99
- context 'Project, IsRuby' do
100
- subject { v.as?(VertexWrapperSpec::Project, VertexWrapperSpec::IsRuby) }
101
- it { should_not be_true }
36
+ describe 'instance' do
37
+ subject do
38
+ v_wrapper_class.new graph, pacer.element
39
+ end
40
+ it { should_not be_nil }
41
+ its(:element) { should_not be_nil }
42
+ it { should == pacer }
43
+ it { should_not equal pacer }
44
+ its(:element_id) { should == pacer.element_id }
45
+ its(:extensions) { should == v_exts }
46
+
47
+ describe 'with more extensions added' do
48
+ subject { v_wrapper_class.new(graph, pacer.element).add_extensions([Pacer::Utils::TSort]) }
49
+ its(:class) { should_not == v_wrapper_class }
50
+ its(:extensions) { should == v_exts + [Pacer::Utils::TSort] }
51
+ end
52
+ end
102
53
  end
103
54
  end
104
55
 
105
- describe '#as' do
106
- context 'vertex is a Project' do
107
- let(:v) { graph.create_vertex type: 'project' }
56
+ Run.all :read_only do
57
+ describe 'type filtering' do
58
+ before :all do
59
+ graph.tx do
60
+ graph.create_vertex type: 'project'
61
+ graph.create_vertex type: 'project'
62
+ graph.create_vertex type: 'file'
63
+ graph.create_vertex language: 'ruby'
64
+ graph.create_vertex language: 'perl'
65
+ end
66
+ end
108
67
 
109
- it 'should yield a Project' do
110
- yielded = false
111
- v.as(VertexWrapperSpec::Project) do |v2|
112
- yielded = true
113
- v2.should == v
114
- v2.extensions.should include VertexWrapperSpec::Project
115
- v2.should be_a VertexWrapperSpec::Project::Vertex
68
+ context Project, 'using route_conditions' do
69
+ specify 'initial lookup' do
70
+ graph.v(Project).count.should == 2
71
+ end
72
+ specify 'filter route' do
73
+ graph.v.v(Project).count.should == 2
116
74
  end
117
- yielded.should be_true
118
75
  end
119
76
 
120
- it 'should not yield a IsRuby' do
121
- yielded = false
122
- v.as(VertexWrapperSpec::IsRuby) do |v2|
123
- yielded = true
77
+ context IsRuby, 'using lookup' do
78
+ specify 'initial lookup' do
79
+ graph.v(IsRuby).count.should == 1
80
+ end
81
+ specify 'filter route' do
82
+ graph.v.v(IsRuby).count.should == 1
124
83
  end
125
- yielded.should be_false
126
84
  end
127
85
  end
128
86
  end
129
87
 
130
- describe '#only_as' do
131
- context 'able' do
132
- subject { graph.create_vertex VertexWrapperSpec::IsRuby, type: 'project', language: 'ruby' }
133
-
134
- its(:extensions) { should include VertexWrapperSpec::IsRuby }
88
+ shared_examples_for Pacer::Wrappers::VertexWrapper do
89
+ use_simple_graph_data
135
90
 
136
- it 'should yield a Project' do
137
- yielded = false
138
- subject.only_as(VertexWrapperSpec::Project) do |v2|
139
- yielded = true
140
- v2.should == subject
141
- v2.extensions.should == [VertexWrapperSpec::Project]
142
- v2.should be_a VertexWrapperSpec::Project::Vertex
143
- end
144
- yielded.should be_true
145
- end
91
+ describe '#v' do
92
+ subject { v0.v }
93
+ it { should be_a_vertices_route }
94
+ its(:element_type) { should == :vertex }
146
95
  end
147
96
 
148
- context 'unable' do
149
- subject { graph.create_vertex VertexWrapperSpec::IsRuby, language: 'ruby' }
97
+ describe '#add_extensions' do
98
+ context 'no extensions' do
99
+ subject { v0.add_extensions([]) }
100
+ its('extensions.to_a') { should == [] }
101
+ its(:class) { should == graph.base_vertex_wrapper }
102
+ end
150
103
 
151
- it 'should not yield a Project' do
152
- yielded = false
153
- subject.only_as(VertexWrapperSpec::Project) do |v2|
154
- yielded = true
104
+ context 'with extensions' do
105
+ subject { v0.add_extensions([Tackle::SimpleMixin]) }
106
+ its('extensions.to_a') { should == [Tackle::SimpleMixin] }
107
+ it { should be_a(Pacer::Wrappers::ElementWrapper) }
108
+ it { should be_a(Pacer::Wrappers::VertexWrapper) }
109
+ it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
110
+
111
+ describe '#v' do
112
+ subject { v0.add_extensions([Tackle::SimpleMixin]).v }
113
+ its('extensions.to_a') { should == [Tackle::SimpleMixin] }
114
+ it { should be_a_vertices_route }
115
+ it { should be_a(Tackle::SimpleMixin::Route) }
155
116
  end
156
- yielded.should be_false
157
117
  end
158
118
  end
159
- end
160
119
 
161
- describe '#delete!' do
162
- before do
163
- @vertex_id = v0.element_id
164
- v0.delete!
165
- c = example.metadata[:graph_commit]
166
- c.call if c
167
- end
168
- it 'should be removed' do
169
- graph.vertex(@vertex_id).should be_nil
120
+ describe '#as?' do
121
+ context 'project' do
122
+ let(:v) { graph.create_vertex type: 'project' }
123
+ context 'Project' do
124
+ subject { v.as?(Project) }
125
+ it { should be_true }
126
+ end
127
+ context 'IsRuby' do
128
+ subject { v.as?(IsRuby) }
129
+ it { should_not be_true }
130
+ end
131
+ context 'Project, IsRuby' do
132
+ subject { v.as?(Project, IsRuby) }
133
+ it { should_not be_true }
134
+ end
135
+ end
136
+ context 'language' do
137
+ let(:v) { graph.create_vertex language: 'ruby' }
138
+ context 'Project' do
139
+ subject { v.as?(Project) }
140
+ it { should_not be_true }
141
+ end
142
+ context 'IsRuby' do
143
+ subject { v.as?(IsRuby) }
144
+ it { should be_true }
145
+ end
146
+ context 'Project, IsRuby' do
147
+ subject { v.as?(Project, IsRuby) }
148
+ it { should_not be_true }
149
+ end
150
+ end
170
151
  end
171
- end
172
152
 
173
- contexts(
174
- 'into new tg' => proc {
175
- let(:dest) { Pacer.tg }
176
- },
177
- 'into graph2' => proc {
178
- before { pending 'support temporary hash indices for clone/copy' unless graph.features.supportsIndices }
179
- let(:dest) { graph2 }
180
- }) do
181
- before do
182
- graph.transaction(nesting: true) { setup_data }
183
- end
184
- describe '#clone_into', :transactions => false, read_transaction: true do
185
- subject { dest.transaction { v0.clone_into(dest) } }
186
- its(:properties) { should == { 'name' => 'eliza' } }
187
- its(:graph) { should equal(dest) }
188
- its('element_id.to_s') { should == v0.element_id.to_s unless graph.features.ignoresSuppliedIds }
189
- end
153
+ describe '#as' do
154
+ context 'vertex is a Project' do
155
+ let(:v) { graph.create_vertex type: 'project' }
156
+
157
+ it 'should yield a Project' do
158
+ yielded = false
159
+ v.as(Project) do |v2|
160
+ yielded = true
161
+ v2.should == v
162
+ v2.extensions.should include Project
163
+ v2.should be_a Project::Vertex
164
+ end
165
+ yielded.should be_true
166
+ end
190
167
 
191
- describe '#copy_into', :transaction => false, read_transaction: true do
192
- subject { v1.copy_into(dest) }
193
- its(:properties) { should == { 'name' => 'darrick' } }
194
- its(:graph) { should equal(dest) }
168
+ it 'should not yield a IsRuby' do
169
+ yielded = false
170
+ v.as(IsRuby) do |v2|
171
+ yielded = true
172
+ end
173
+ yielded.should be_false
174
+ end
175
+ end
195
176
  end
196
- end
197
177
 
198
- subject { graph.transaction(nesting: true) { setup_data; v0 } }
199
- its(:graph) { should equal(graph) }
200
- its(:display_name) { should be_nil }
201
- its(:inspect) { should =~ /#<[VM]\[#{Regexp.quote v0.element_id.to_s }\]>/ }
202
- context 'with label proc' do
203
- before do
204
- graph.vertex_name = proc { |e| "some name" }
205
- end
206
- its(:display_name) { should == "some name" }
207
- its(:inspect) { should =~ /#<[VM]\[#{ Regexp.quote v0.element_id.to_s }\] some name>/ }
208
- end
209
- it { should_not == v1 }
210
- it { should == v0 }
211
- context 'edge with same element id', :transactions => false, read_transaction: true do
212
- it { should_not == e0 }
213
- end
178
+ describe '#only_as' do
179
+ context 'able' do
180
+ subject { graph.create_vertex IsRuby, type: 'project', language: 'ruby' }
181
+
182
+ its(:extensions) { should include IsRuby }
183
+
184
+ it 'should yield a Project' do
185
+ yielded = false
186
+ subject.only_as(Project) do |v2|
187
+ yielded = true
188
+ v2.should == subject
189
+ v2.extensions.should == [Project]
190
+ v2.should be_a Project::Vertex
191
+ end
192
+ yielded.should be_true
193
+ end
194
+ end
214
195
 
215
- context 'with more data' do
216
- let(:from_v) { graph.create_vertex }
217
- let(:to_v) { graph.create_vertex }
196
+ context 'unable' do
197
+ subject { graph.create_vertex IsRuby, language: 'ruby' }
218
198
 
219
- before do
220
- %w[ a a a b b c ].each do |label|
221
- v = graph.create_vertex
222
- graph.create_edge nil, from_v, v, label
223
- graph.create_edge nil, v, to_v, label
199
+ it 'should not yield a Project' do
200
+ yielded = false
201
+ subject.only_as(Project) do |v2|
202
+ yielded = true
203
+ end
204
+ yielded.should be_false
205
+ end
224
206
  end
225
207
  end
226
208
 
227
- describe '#in_edges' do
228
- specify 'to_v should have 6 in edges' do
229
- to_v.in_edges.count.should == 6
209
+ describe '#delete!' do
210
+ before do
211
+ @vertex_id = v0.element_id
212
+ v0.delete!
213
+ c = example.metadata[:graph_commit]
214
+ c.call if c
230
215
  end
231
-
232
- specify 'to_v should have 3 in edges with label a' do
233
- to_v.in_edges('a').count.should == 3
216
+ it 'should be removed' do
217
+ graph.vertex(@vertex_id).should be_nil
234
218
  end
219
+ end
235
220
 
236
- specify 'to_v should have 4 in edges with label a or c' do
237
- to_v.in_edges('a', 'c').count.should == 4
221
+ contexts(
222
+ 'into new tg' => proc {
223
+ let(:dest) { Pacer.tg }
224
+ },
225
+ 'into graph2' => proc {
226
+ before { pending 'support temporary hash indices for clone/copy' unless graph.features.supportsIndices }
227
+ let(:dest) { graph2 }
228
+ }
229
+ ) do
230
+ before do
231
+ graph.transaction(nesting: true) { setup_data }
238
232
  end
239
-
240
- it 'should add an extension' do
241
- edge = to_v.in_edges(Tackle::SimpleMixin).first
242
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
243
- edge.extensions.should include(Tackle::SimpleMixin)
233
+ describe '#clone_into', :transactions => false, read_transaction: true do
234
+ subject { dest.transaction { v0.clone_into(dest) } }
235
+ its(:properties) { should == { 'name' => 'eliza' } }
236
+ its(:graph) { should equal(dest) }
237
+ its('element_id.to_s') { should == v0.element_id.to_s unless graph.features.ignoresSuppliedIds }
244
238
  end
245
239
 
246
- it 'should be able to mix labels and mixins as arguments' do
247
- edge = to_v.in_edges('a', Tackle::SimpleMixin, 'b').first
248
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
249
- edge.extensions.should include(Tackle::SimpleMixin)
240
+ describe '#copy_into', :transaction => false, read_transaction: true do
241
+ subject { v1.copy_into(dest) }
242
+ its(:properties) { should == { 'name' => 'darrick' } }
243
+ its(:graph) { should equal(dest) }
250
244
  end
245
+ end
251
246
 
252
- it 'should filter correctly with a mix of labels and mixins as arguments' do
253
- to_v.in_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
247
+ subject { graph.transaction(nesting: true) { setup_data; v0 } }
248
+ its(:graph) { should equal(graph) }
249
+ its(:display_name) { should be_nil }
250
+ its(:inspect) { should =~ /#<[VM]\[#{Regexp.quote v0.element_id.to_s }\]>/ }
251
+ context 'with label proc' do
252
+ before do
253
+ graph.vertex_name = proc { |e| "some name" }
254
254
  end
255
+ its(:display_name) { should == "some name" }
256
+ its(:inspect) { should =~ /#<[VM]\[#{ Regexp.quote v0.element_id.to_s }\] some name>/ }
257
+ end
258
+ it { should_not == v1 }
259
+ it { should == v0 }
260
+ context 'edge with same element id', :transactions => false, read_transaction: true do
261
+ it { should_not == e0 }
255
262
  end
256
263
 
257
- describe '#out_edges' do
258
- specify 'from_v should have 6 out edges' do
259
- from_v.out_edges.count.should == 6
260
- end
264
+ context 'with more data' do
265
+ let(:from_v) { graph.create_vertex }
266
+ let(:to_v) { graph.create_vertex }
261
267
 
262
- specify 'from_v should have 3 out edges with label a' do
263
- from_v.out_edges('a').count.should == 3
268
+ before do
269
+ %w[ a a a b b c ].each do |label|
270
+ v = graph.create_vertex
271
+ graph.create_edge nil, from_v, v, label
272
+ graph.create_edge nil, v, to_v, label
273
+ end
264
274
  end
265
275
 
266
- specify 'from_v should have 4 out edges with label a or c' do
267
- from_v.out_edges('a', 'c').count.should == 4
268
- end
276
+ describe '#in_edges' do
277
+ specify 'to_v should have 6 in edges' do
278
+ to_v.in_edges.count.should == 6
279
+ end
269
280
 
270
- it 'should add an extension' do
271
- edge = from_v.out_edges(Tackle::SimpleMixin).first
272
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
273
- edge.extensions.should include(Tackle::SimpleMixin)
274
- end
281
+ specify 'to_v should have 3 in edges with label a' do
282
+ to_v.in_edges('a').count.should == 3
283
+ end
275
284
 
276
- it 'should be able to mix labels and mixins as arguments' do
277
- edge = from_v.out_edges('a', Tackle::SimpleMixin, 'b').first
278
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
279
- edge.extensions.should include(Tackle::SimpleMixin)
280
- end
285
+ specify 'to_v should have 4 in edges with label a or c' do
286
+ to_v.in_edges('a', 'c').count.should == 4
287
+ end
281
288
 
282
- it 'should filter correctly with a mix of labels and mixins as arguments' do
283
- from_v.out_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
284
- end
285
- end
289
+ it 'should add an extension' do
290
+ edge = to_v.in_edges(Tackle::SimpleMixin).first
291
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
292
+ edge.extensions.should include(Tackle::SimpleMixin)
293
+ end
286
294
 
287
- describe '#both_edges' do
288
- specify 'from_v should have 6 edges' do
289
- from_v.both_edges.count.should == 6
290
- end
295
+ it 'should be able to mix labels and mixins as arguments' do
296
+ edge = to_v.in_edges('a', Tackle::SimpleMixin, 'b').first
297
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
298
+ edge.extensions.should include(Tackle::SimpleMixin)
299
+ end
291
300
 
292
- specify 'from_v should have 3 edges with label a' do
293
- from_v.both_edges('a').count.should == 3
301
+ it 'should filter correctly with a mix of labels and mixins as arguments' do
302
+ to_v.in_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
303
+ end
294
304
  end
295
305
 
296
- specify 'from_v should have 4 edges with label a or c' do
297
- from_v.both_edges('a', 'c').count.should == 4
298
- end
306
+ describe '#out_edges' do
307
+ specify 'from_v should have 6 out edges' do
308
+ from_v.out_edges.count.should == 6
309
+ end
299
310
 
300
- it 'should add an extension' do
301
- edge = from_v.both_edges(Tackle::SimpleMixin).first
302
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
303
- edge.extensions.should include(Tackle::SimpleMixin)
304
- end
311
+ specify 'from_v should have 3 out edges with label a' do
312
+ from_v.out_edges('a').count.should == 3
313
+ end
314
+
315
+ specify 'from_v should have 4 out edges with label a or c' do
316
+ from_v.out_edges('a', 'c').count.should == 4
317
+ end
305
318
 
306
- it 'should be able to mix labels and mixins as arguments' do
307
- edge = from_v.both_edges('a', Tackle::SimpleMixin, 'b').first
308
- edge.should be_a(Pacer::Wrappers::EdgeWrapper)
309
- edge.extensions.should include(Tackle::SimpleMixin)
319
+ it 'should add an extension' do
320
+ edge = from_v.out_edges(Tackle::SimpleMixin).first
321
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
322
+ edge.extensions.should include(Tackle::SimpleMixin)
323
+ end
324
+
325
+ it 'should be able to mix labels and mixins as arguments' do
326
+ edge = from_v.out_edges('a', Tackle::SimpleMixin, 'b').first
327
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
328
+ edge.extensions.should include(Tackle::SimpleMixin)
329
+ end
330
+
331
+ it 'should filter correctly with a mix of labels and mixins as arguments' do
332
+ from_v.out_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
333
+ end
310
334
  end
311
335
 
312
- it 'should filter correctly with a mix of labels and mixins as arguments' do
313
- from_v.both_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
336
+ describe '#both_edges' do
337
+ specify 'from_v should have 6 edges' do
338
+ from_v.both_edges.count.should == 6
339
+ end
340
+
341
+ specify 'from_v should have 3 edges with label a' do
342
+ from_v.both_edges('a').count.should == 3
343
+ end
344
+
345
+ specify 'from_v should have 4 edges with label a or c' do
346
+ from_v.both_edges('a', 'c').count.should == 4
347
+ end
348
+
349
+ it 'should add an extension' do
350
+ edge = from_v.both_edges(Tackle::SimpleMixin).first
351
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
352
+ edge.extensions.should include(Tackle::SimpleMixin)
353
+ end
354
+
355
+ it 'should be able to mix labels and mixins as arguments' do
356
+ edge = from_v.both_edges('a', Tackle::SimpleMixin, 'b').first
357
+ edge.should be_a(Pacer::Wrappers::EdgeWrapper)
358
+ edge.extensions.should include(Tackle::SimpleMixin)
359
+ end
360
+
361
+ it 'should filter correctly with a mix of labels and mixins as arguments' do
362
+ from_v.both_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
363
+ end
314
364
  end
315
365
  end
316
366
  end
317
- end
318
367
 
319
- Run.all do
320
- it_uses Pacer::Wrappers::VertexWrapper
368
+ Run.all do
369
+ it_uses Pacer::Wrappers::VertexWrapper
370
+ end
321
371
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
4
+ version: 2.0.14
5
5
  platform: java
6
6
  authors:
7
7
  - Darrick Wiebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lock_jar