bumbleworks 0.0.52 → 0.0.53
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bumbleworks/entity.rb +5 -3
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/lib/bumbleworks/entity_spec.rb +11 -6
- metadata +4 -4
data/lib/bumbleworks/entity.rb
CHANGED
@@ -37,12 +37,14 @@ module Bumbleworks
|
|
37
37
|
processes_by_name.values.compact
|
38
38
|
end
|
39
39
|
|
40
|
-
def cancel_all_processes!
|
40
|
+
def cancel_all_processes!(options = {})
|
41
41
|
processes_by_name.each do |name, process|
|
42
42
|
next unless process
|
43
|
-
identifier_attribute = attribute_for_process_name(name)
|
44
43
|
process.cancel!
|
45
|
-
|
44
|
+
unless options[:clear_identifiers] == false
|
45
|
+
identifier_attribute = attribute_for_process_name(name)
|
46
|
+
persist_process_identifier(identifier_attribute, nil)
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
data/lib/bumbleworks/version.rb
CHANGED
@@ -45,23 +45,28 @@ describe Bumbleworks::Entity do
|
|
45
45
|
|
46
46
|
describe '#cancel_all_processes!' do
|
47
47
|
it 'cancels all processes with registered identifiers' do
|
48
|
-
[:zoom, :foof, :nook].each do |pname|
|
49
|
-
entity_class.send(:attr_accessor, :"#{pname}_pid")
|
50
|
-
entity_class.process pname, :attribute => :"#{pname}_pid"
|
51
|
-
end
|
52
48
|
entity = entity_class.new
|
53
|
-
entity.foof_pid = '1234'
|
54
|
-
entity.nook_pid = 'pickles'
|
55
49
|
entity.stub(:processes_by_name => {
|
56
50
|
:foof => bp1 = Bumbleworks::Process.new('1234'),
|
57
51
|
:nook => bp2 = Bumbleworks::Process.new('pickles')
|
58
52
|
})
|
59
53
|
bp1.should_receive(:cancel!)
|
60
54
|
bp2.should_receive(:cancel!)
|
55
|
+
entity.stub(:attribute_for_process_name) { |name| :"#{name}_pid" }
|
61
56
|
entity.should_receive(:update).with(:foof_pid => nil)
|
62
57
|
entity.should_receive(:update).with(:nook_pid => nil)
|
63
58
|
entity.cancel_all_processes!
|
64
59
|
end
|
60
|
+
|
61
|
+
it 'does not clear identifiers if clear_identifiers option is false' do
|
62
|
+
entity = entity_class.new
|
63
|
+
entity.stub(:processes_by_name => {
|
64
|
+
:foof => bp = Bumbleworks::Process.new('1234')
|
65
|
+
})
|
66
|
+
bp.should_receive(:cancel!)
|
67
|
+
entity.should_receive(:update).never
|
68
|
+
entity.cancel_all_processes!(:clear_identifiers => false)
|
69
|
+
end
|
65
70
|
end
|
66
71
|
|
67
72
|
describe '#process_fields' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumbleworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.53
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-12-
|
15
|
+
date: 2013-12-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
segments:
|
260
260
|
- 0
|
261
|
-
hash: -
|
261
|
+
hash: -1658665991702061077
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
none: false
|
264
264
|
requirements:
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
version: '0'
|
268
268
|
segments:
|
269
269
|
- 0
|
270
|
-
hash: -
|
270
|
+
hash: -1658665991702061077
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
273
|
rubygems_version: 1.8.23
|