bumbleworks 0.0.88 → 0.0.89

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: 8e7f5891aaff2d00d0129acf222c6a1ee06c74e2
4
- data.tar.gz: 59288f755a48cd12069cbbe898037fde62cbfb2e
3
+ metadata.gz: 20718cc55b3e2049dd69f7772e53842e8986207d
4
+ data.tar.gz: c6f332a2969e7c5b42ce2de781194011c5254664
5
5
  SHA512:
6
- metadata.gz: 3ec00ab19a09a29fe07dcf810282c0ad40ab83e0bfb876d491c7b9fb6f01c32022d39c0924bca8b9d49b3b674b67e6e2e1fca678a2b1e7eaad751f8410541673
7
- data.tar.gz: 4c889ebea8ed536c90c16f0660030837c7f29c4c70b62a75d70762f9e12ac61979537dcb14730150e894c16356d62a0af0709ac6122620931bfff696f20a1b3b
6
+ metadata.gz: 5441e543b1bc553e948df94b60073bac6377dd748d719b638254c3a19c79c4919370c5d621f8759ea57f8647e2bf667fc77738e973c7dc1176f612db68dce1c2
7
+ data.tar.gz: c46e6753af936b3fd24b311b553dbcf57d91b6e59b4d69f98cb54a12454fb5dad0a62d8171741c3c0fd23e5e30062beb0fa26142c93b3b23997d22ff28b8f5ef
@@ -108,25 +108,25 @@ module Bumbleworks
108
108
  call_hooks(:after, action, *args)
109
109
  end
110
110
 
111
- def with_hooks(action, *args, &block)
112
- call_before_hooks(action, *args)
111
+ def with_hooks(action, metadata, options = {})
112
+ call_before_hooks(action, metadata) unless options[:skip_callbacks]
113
113
  yield
114
- call_after_hooks(action, *args)
114
+ call_after_hooks(action, metadata) unless options[:skip_callbacks]
115
115
  end
116
116
 
117
117
  # update workitem with changes to fields & params
118
- def update(metadata = {})
119
- with_hooks(:update, metadata) do
118
+ def update(metadata = {}, options = {})
119
+ with_hooks(:update, metadata, options) do
120
120
  update_workitem
121
121
  log(:update, metadata)
122
122
  end
123
123
  end
124
124
 
125
125
  # proceed workitem (saving changes to fields)
126
- def complete(metadata = {})
126
+ def complete(metadata = {}, options = {})
127
127
  raise NotCompletable.new(not_completable_error_message) unless completable?
128
- with_hooks(:update, metadata) do
129
- with_hooks(:complete, metadata) do
128
+ with_hooks(:update, metadata, options) do
129
+ with_hooks(:complete, metadata, options) do
130
130
  proceed_workitem
131
131
  log(:complete, metadata)
132
132
  end
@@ -144,8 +144,8 @@ module Bumbleworks
144
144
  end
145
145
 
146
146
  # Claim task and assign token to claimant
147
- def claim(token)
148
- with_hooks(:claim, token) do
147
+ def claim(token, options = {})
148
+ with_hooks(:claim, token, options) do
149
149
  set_claimant(token)
150
150
  log(:claim)
151
151
  end
@@ -157,9 +157,9 @@ module Bumbleworks
157
157
  end
158
158
 
159
159
  # release claim on task.
160
- def release
160
+ def release(options = {})
161
161
  current_claimant = claimant
162
- with_hooks(:release, current_claimant) do
162
+ with_hooks(:release, current_claimant, options) do
163
163
  log(:release)
164
164
  set_claimant(nil)
165
165
  end
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.88"
2
+ VERSION = "0.0.89"
3
3
  end
@@ -787,6 +787,15 @@ describe Bumbleworks::Task do
787
787
  task.claim(:doctor_claim)
788
788
  end
789
789
 
790
+ it 'skips callbacks if requested' do
791
+ task = described_class.new(workflow_item)
792
+ allow(task).to receive(:log)
793
+ expect(task).to receive(:before_claim).never
794
+ expect(task).to receive(:set_claimant)
795
+ expect(task).to receive(:after_claim).never
796
+ task.claim(:doctor_claim, :skip_callbacks => true)
797
+ end
798
+
790
799
  it 'logs event' do
791
800
  log_entry = Bumbleworks.logger.entries.last[:entry]
792
801
  expect(log_entry[:action]).to eq(:claim)
@@ -836,6 +845,13 @@ describe Bumbleworks::Task do
836
845
  @task.release
837
846
  end
838
847
 
848
+ it 'skips callbacks if requested' do
849
+ expect(@task).to receive(:call_before_hooks).never
850
+ expect(@task).to receive(:set_claimant)
851
+ expect(@task).to receive(:call_after_hooks).never
852
+ @task.release(:skip_callbacks => true)
853
+ end
854
+
839
855
  it 'logs event' do
840
856
  @task.release
841
857
  log_entry = Bumbleworks.logger.entries.last[:entry]
@@ -875,6 +891,15 @@ describe Bumbleworks::Task do
875
891
  task.update(:argue_mints)
876
892
  end
877
893
 
894
+ it 'skips callbacks if requested' do
895
+ task = described_class.new(workflow_item)
896
+ allow(task).to receive(:log)
897
+ expect(task).to receive(:call_before_hooks).never
898
+ expect(task).to receive(:update_workitem)
899
+ expect(task).to receive(:call_after_hooks).never
900
+ task.update({:actual => :params}, {:skip_callbacks => true})
901
+ end
902
+
878
903
  it 'reloads after updating workitem' do
879
904
  event = Bumbleworks.dashboard.wait_for :dog_mouth
880
905
  task = described_class.for_role('dog_mouth').first
@@ -945,6 +970,15 @@ describe Bumbleworks::Task do
945
970
  task.complete(:argue_mints)
946
971
  end
947
972
 
973
+ it 'skips callbacks if requested' do
974
+ task = described_class.new(workflow_item)
975
+ allow(task).to receive(:log)
976
+ expect(task).to receive(:call_before_hooks).never
977
+ expect(task).to receive(:proceed_workitem)
978
+ expect(task).to receive(:call_after_hooks).never
979
+ task.complete({:actual => :params}, {:skip_callbacks => true})
980
+ end
981
+
948
982
  it 'logs event' do
949
983
  event = Bumbleworks.dashboard.wait_for :dog_mouth
950
984
  task = described_class.for_role('dog_mouth').first
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.88
4
+ version: 0.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maher Hawash
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-30 00:00:00.000000000 Z
14
+ date: 2014-11-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ruote