bumbleworks 0.0.73 → 0.0.74
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bumbleworks.rb +10 -5
- data/lib/bumbleworks/ruote.rb +10 -4
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/integration/entity_spec.rb +0 -1
- data/spec/integration/history_storage_spec.rb +0 -4
- data/spec/integration/sample_application_spec.rb +0 -1
- data/spec/lib/bumbleworks/expression_spec.rb +0 -2
- data/spec/lib/bumbleworks/participant_registration_spec.rb +0 -1
- data/spec/lib/bumbleworks/process/error_record_spec.rb +0 -2
- data/spec/lib/bumbleworks/process_definition_spec.rb +0 -5
- data/spec/lib/bumbleworks/process_spec.rb +0 -2
- data/spec/lib/bumbleworks/ruote/exp/broadcast_event_expression_spec.rb +0 -2
- data/spec/lib/bumbleworks/ruote/exp/wait_for_event_expression_spec.rb +0 -2
- data/spec/lib/bumbleworks/ruote_spec.rb +6 -7
- data/spec/lib/bumbleworks/task/finder_spec.rb +0 -2
- data/spec/lib/bumbleworks/task_spec.rb +0 -2
- data/spec/lib/bumbleworks/tracker_spec.rb +0 -2
- data/spec/lib/bumbleworks_spec.rb +12 -4
- data/spec/spec_helper.rb +9 -0
- metadata +4 -4
data/lib/bumbleworks.rb
CHANGED
@@ -88,7 +88,7 @@ module Bumbleworks
|
|
88
88
|
# @yield [configuration] global configuration
|
89
89
|
# @see Bumbleworks.configure
|
90
90
|
def configure!(&block)
|
91
|
-
|
91
|
+
clear_configuration!
|
92
92
|
configure(&block)
|
93
93
|
end
|
94
94
|
|
@@ -142,12 +142,17 @@ module Bumbleworks
|
|
142
142
|
end
|
143
143
|
|
144
144
|
# @public
|
145
|
-
# Resets Bumbleworks -
|
146
|
-
#
|
147
|
-
#
|
145
|
+
# Resets Bumbleworks - resets dashboard, purges storage, and clears
|
146
|
+
# configuration and setup variables.
|
148
147
|
def reset!
|
149
|
-
@configuration = nil
|
150
148
|
Bumbleworks::Ruote.reset!
|
149
|
+
clear_configuration!
|
150
|
+
end
|
151
|
+
|
152
|
+
# @public
|
153
|
+
# Clears configuration completely, resetting to defaults.
|
154
|
+
def clear_configuration!
|
155
|
+
@configuration = nil
|
151
156
|
end
|
152
157
|
|
153
158
|
# @public
|
data/lib/bumbleworks/ruote.rb
CHANGED
@@ -146,18 +146,24 @@ module Bumbleworks
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def storage
|
149
|
-
@storage ||=
|
149
|
+
@storage ||= initialize_storage_adapter
|
150
150
|
end
|
151
151
|
|
152
152
|
def reset!
|
153
|
-
if
|
154
|
-
|
155
|
-
|
153
|
+
if Bumbleworks.storage && storage
|
154
|
+
storage.purge!
|
155
|
+
storage.shutdown
|
156
156
|
end
|
157
157
|
@dashboard.shutdown if @dashboard && @dashboard.respond_to?(:shutdown)
|
158
158
|
@storage = nil
|
159
159
|
@dashboard = nil
|
160
160
|
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
def initialize_storage_adapter
|
165
|
+
Bumbleworks.storage_adapter.new_storage(Bumbleworks.storage, Bumbleworks.storage_options)
|
166
|
+
end
|
161
167
|
end
|
162
168
|
end
|
163
169
|
end
|
data/lib/bumbleworks/version.rb
CHANGED
@@ -46,7 +46,6 @@ describe Bumbleworks::Expression do
|
|
46
46
|
|
47
47
|
describe '#cancel!' do
|
48
48
|
it 'cancels the expression' do
|
49
|
-
Bumbleworks.storage = {}
|
50
49
|
Bumbleworks.dashboard.should_receive(:cancel_expression).with(fei)
|
51
50
|
subject.cancel!
|
52
51
|
end
|
@@ -54,7 +53,6 @@ describe Bumbleworks::Expression do
|
|
54
53
|
|
55
54
|
describe '#kill!' do
|
56
55
|
it 'kills the expression' do
|
57
|
-
Bumbleworks.storage = {}
|
58
56
|
Bumbleworks.dashboard.should_receive(:kill_expression).with(fei)
|
59
57
|
subject.kill!
|
60
58
|
end
|
@@ -2,8 +2,6 @@ require File.expand_path(File.join(fixtures_path, 'participants', 'naughty_parti
|
|
2
2
|
|
3
3
|
describe Bumbleworks::Process::ErrorRecord do
|
4
4
|
before :each do
|
5
|
-
Bumbleworks.reset!
|
6
|
-
Bumbleworks.storage = {}
|
7
5
|
Bumbleworks::Ruote.register_participants do
|
8
6
|
fall_apart NaughtyParticipant
|
9
7
|
end
|
@@ -1,9 +1,4 @@
|
|
1
1
|
describe Bumbleworks::Ruote do
|
2
|
-
before :each do
|
3
|
-
Bumbleworks.reset!
|
4
|
-
Bumbleworks.storage = {}
|
5
|
-
end
|
6
|
-
|
7
2
|
describe ".cancel_process!" do
|
8
3
|
before :each do
|
9
4
|
Bumbleworks.start_worker!
|
@@ -398,11 +393,15 @@ describe Bumbleworks::Ruote do
|
|
398
393
|
|
399
394
|
describe '.reset!' do
|
400
395
|
it 'purges and shuts down storage, then resets storage' do
|
401
|
-
old_storage =
|
396
|
+
old_storage = double('Storage')
|
397
|
+
allow(described_class).to receive(:initialize_storage_adapter).and_return(old_storage)
|
402
398
|
old_storage.should_receive(:purge!)
|
403
399
|
old_storage.should_receive(:shutdown)
|
404
400
|
described_class.reset!
|
405
|
-
described_class.
|
401
|
+
allow(described_class).to receive(:initialize_storage_adapter).and_return(:new_storage)
|
402
|
+
described_class.storage.should == :new_storage
|
403
|
+
# clean up
|
404
|
+
described_class.instance_variable_set(:@storage, nil)
|
406
405
|
end
|
407
406
|
|
408
407
|
it 'skips purging and shutting down of storage if no storage' do
|
@@ -2,8 +2,6 @@ describe Bumbleworks::Task do
|
|
2
2
|
let(:workflow_item) {Ruote::Workitem.new('fields' => {'params' => {'task' => 'go_to_work'} })}
|
3
3
|
|
4
4
|
before :each do
|
5
|
-
Bumbleworks.reset!
|
6
|
-
Bumbleworks.storage = {}
|
7
5
|
Bumbleworks::Ruote.register_participants
|
8
6
|
Bumbleworks.start_worker!
|
9
7
|
end
|
@@ -35,12 +35,19 @@ describe Bumbleworks do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe '.clear_configuration!' do
|
39
|
+
it 'resets configuration' do
|
40
|
+
old_config = described_class.configuration
|
41
|
+
described_class.clear_configuration!
|
42
|
+
described_class.configuration.should_not == old_config
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
describe '.reset!' do
|
39
47
|
it 'resets configuration and resets ruote' do
|
40
|
-
|
41
|
-
|
48
|
+
expect(Bumbleworks::Ruote).to receive(:reset!).ordered
|
49
|
+
expect(described_class).to receive(:clear_configuration!).ordered
|
42
50
|
described_class.reset!
|
43
|
-
described_class.configuration.should_not == old_config
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
@@ -134,7 +141,6 @@ describe Bumbleworks do
|
|
134
141
|
|
135
142
|
describe '.configuration' do
|
136
143
|
before :each do
|
137
|
-
Bumbleworks.reset!
|
138
144
|
Bumbleworks::StorageAdapter.auto_register = nil
|
139
145
|
end
|
140
146
|
|
@@ -149,11 +155,13 @@ describe Bumbleworks do
|
|
149
155
|
|
150
156
|
it 'automatically adds Redis adapter if defined' do
|
151
157
|
stub_const('Bumbleworks::Redis::Adapter', Bumbleworks::StorageAdapter)
|
158
|
+
Bumbleworks.clear_configuration! # to reload storage adapters
|
152
159
|
described_class.configuration.storage_adapters.should include(Bumbleworks::Redis::Adapter)
|
153
160
|
end
|
154
161
|
|
155
162
|
it 'automatically adds Sequel adapter if defined' do
|
156
163
|
stub_const('Bumbleworks::Sequel::Adapter', Bumbleworks::StorageAdapter)
|
164
|
+
Bumbleworks.clear_configuration! # to reload storage adapters
|
157
165
|
described_class.configuration.storage_adapters.should include(Bumbleworks::Sequel::Adapter)
|
158
166
|
end
|
159
167
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,4 +16,13 @@ RSpec.configure do |config|
|
|
16
16
|
# the seed, which is printed after each run.
|
17
17
|
# --seed 1234
|
18
18
|
config.order = 'random'
|
19
|
+
|
20
|
+
config.before(:each) do
|
21
|
+
# Yup, we're setting the storage twice - the first time is to
|
22
|
+
# ensure that the .reset! isn't trying to access a test double, and
|
23
|
+
# the second is to initialize it to a hash for tests.
|
24
|
+
Bumbleworks.storage = nil
|
25
|
+
Bumbleworks.reset!
|
26
|
+
Bumbleworks.storage = {}
|
27
|
+
end
|
19
28
|
end
|
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.74
|
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: 2014-03-
|
15
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|
@@ -271,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
271
|
version: '0'
|
272
272
|
segments:
|
273
273
|
- 0
|
274
|
-
hash:
|
274
|
+
hash: 1064429954326837811
|
275
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
276
|
none: false
|
277
277
|
requirements:
|
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
segments:
|
282
282
|
- 0
|
283
|
-
hash:
|
283
|
+
hash: 1064429954326837811
|
284
284
|
requirements: []
|
285
285
|
rubyforge_project:
|
286
286
|
rubygems_version: 1.8.23
|