bumbleworks 0.0.52 → 0.0.53

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.
@@ -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
- persist_process_identifier(identifier_attribute, nil)
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
 
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.52"
2
+ VERSION = "0.0.53"
3
3
  end
@@ -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.52
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-23 00:00:00.000000000 Z
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: -2295219259305146267
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: -2295219259305146267
270
+ hash: -1658665991702061077
271
271
  requirements: []
272
272
  rubyforge_project:
273
273
  rubygems_version: 1.8.23