dor-workflow-client 4.1.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,23 +32,6 @@ RSpec.describe Dor::Workflow::Response::Process do
32
32
  it { is_expected.to eq 'assemblyWF' }
33
33
  end
34
34
 
35
- describe '#repository' do
36
- before do
37
- allow(Deprecation).to receive(:warn)
38
- end
39
-
40
- subject { instance.repository }
41
-
42
- let(:xml) do
43
- <<~XML
44
- <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
45
- <process name="start-assembly">
46
- </workflow>
47
- XML
48
- end
49
- it { is_expected.to eq 'dor' }
50
- end
51
-
52
35
  describe '#name' do
53
36
  subject { instance.name }
54
37
 
@@ -29,22 +29,6 @@ RSpec.describe Dor::Workflow::Response::Workflow do
29
29
  it { is_expected.to eq 'assemblyWF' }
30
30
  end
31
31
 
32
- describe '#repository' do
33
- subject { instance.repository }
34
-
35
- before do
36
- allow(Deprecation).to receive(:warn)
37
- end
38
-
39
- let(:xml) do
40
- <<~XML
41
- <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
42
- </workflow>
43
- XML
44
- end
45
- it { is_expected.to eq 'dor' }
46
- end
47
-
48
32
  describe '#complete?' do
49
33
  subject { instance.complete? }
50
34
  context 'when all steps are complete' do
@@ -17,177 +17,43 @@ RSpec.describe Dor::Workflow::Client::LifecycleRoutes do
17
17
 
18
18
  before do
19
19
  allow(routes).to receive(:query_lifecycle).and_return(ng_xml)
20
- allow(Deprecation).to receive(:warn)
21
20
  end
22
21
 
23
- context 'with positional arguments' do
24
- subject(:milestones) { routes.milestones(repo, druid) }
22
+ subject(:milestones) { routes.milestones(druid: druid) }
25
23
 
26
- it 'includes the version in with the milestones' do
27
- expect(milestones.first[:milestone]).to eq('published')
28
- expect(milestones.first[:version]).to eq('2')
29
- expect(Deprecation).to have_received(:warn).twice
30
- end
31
- end
32
-
33
- context 'with kwargs' do
34
- subject(:milestones) { routes.milestones(druid: druid) }
35
-
36
- it 'includes the version in with the milestones' do
37
- expect(milestones.first[:milestone]).to eq('published')
38
- expect(milestones.first[:version]).to eq('2')
39
- end
24
+ it 'includes the version in with the milestones' do
25
+ expect(milestones.first[:milestone]).to eq('published')
26
+ expect(milestones.first[:version]).to eq('2')
40
27
  end
41
28
  end
42
29
 
43
30
  describe '#lifecycle' do
44
- context 'with positional arguments' do
45
- before do
46
- allow(Deprecation).to receive(:warn)
47
- end
48
-
49
- context 'without version' do
50
- subject(:lifecycle) { routes.lifecycle(repo, druid, 'submitted') }
51
-
52
- it 'make the request' do
53
- lifecycle
54
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle')
55
- expect(Deprecation).to have_received(:warn).twice
56
- end
57
- end
58
-
59
- context 'with version' do
60
- subject(:lifecycle) { routes.lifecycle(repo, druid, 'submitted', version: 3) }
31
+ context 'without version' do
32
+ subject(:lifecycle) { routes.lifecycle(druid: druid, milestone_name: 'submitted') }
61
33
 
62
- it 'makes the request with the version' do
63
- lifecycle
64
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3')
65
- expect(Deprecation).to have_received(:warn).twice
66
- end
34
+ it 'make the request' do
35
+ lifecycle
36
+ expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle')
67
37
  end
68
38
  end
69
39
 
70
- context 'with kwargs' do
71
- before do
72
- allow(Deprecation).to receive(:warn)
73
- end
74
-
75
- context 'with deprecated repo arg' do
76
- context 'without version' do
77
- subject(:lifecycle) { routes.lifecycle(repo: repo, druid: druid, milestone_name: 'submitted') }
78
-
79
- it 'make the request' do
80
- lifecycle
81
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle')
82
- expect(Deprecation).to have_received(:warn)
83
- end
84
- end
85
-
86
- context 'with version' do
87
- subject(:lifecycle) { routes.lifecycle(repo: repo, druid: druid, milestone_name: 'submitted', version: 3) }
40
+ context 'with version' do
41
+ subject(:lifecycle) { routes.lifecycle(druid: druid, milestone_name: 'submitted', version: 3) }
88
42
 
89
- it 'makes the request with the version' do
90
- lifecycle
91
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3')
92
- expect(Deprecation).to have_received(:warn)
93
- end
94
- end
95
- end
96
-
97
- context 'without version' do
98
- subject(:lifecycle) { routes.lifecycle(druid: druid, milestone_name: 'submitted') }
99
-
100
- it 'make the request' do
101
- lifecycle
102
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle')
103
- expect(Deprecation).not_to have_received(:warn)
104
- end
105
- end
106
-
107
- context 'with version' do
108
- subject(:lifecycle) { routes.lifecycle(druid: druid, milestone_name: 'submitted', version: 3) }
109
-
110
- it 'makes the request with the version' do
111
- lifecycle
112
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3')
113
- expect(Deprecation).not_to have_received(:warn)
114
- end
43
+ it 'makes the request with the version' do
44
+ lifecycle
45
+ expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3')
115
46
  end
116
47
  end
117
48
  end
118
49
 
119
50
  describe '#active_lifecycle' do
120
- context 'with positional arguments' do
121
- before do
122
- allow(Deprecation).to receive(:warn)
123
- end
124
-
125
- context 'without version' do
126
- subject(:active_lifecycle) { routes.active_lifecycle(repo, druid, 'submitted') }
127
-
128
- it 'make the request' do
129
- active_lifecycle
130
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?active-only=true')
131
- expect(Deprecation).to have_received(:warn).twice
132
- end
133
- end
134
-
135
- context 'with version' do
136
- subject(:active_lifecycle) { routes.active_lifecycle(repo, druid, 'submitted', version: 3) }
137
-
138
- it 'makes the request with the version' do
139
- active_lifecycle
140
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3&active-only=true')
141
- expect(Deprecation).to have_received(:warn).twice
142
- end
143
- end
144
- end
145
-
146
51
  context 'with kwargs' do
147
- before do
148
- allow(Deprecation).to receive(:warn)
149
- end
150
-
151
- context 'with deprecated repo arg' do
152
- context 'without version' do
153
- subject(:active_lifecycle) { routes.active_lifecycle(repo: repo, druid: druid, milestone_name: 'submitted') }
154
-
155
- it 'make the request' do
156
- active_lifecycle
157
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?active-only=true')
158
- expect(Deprecation).to have_received(:warn)
159
- end
160
- end
161
-
162
- context 'with version' do
163
- subject(:active_lifecycle) { routes.active_lifecycle(repo: repo, druid: druid, milestone_name: 'submitted', version: 3) }
164
-
165
- it 'makes the request with the version' do
166
- active_lifecycle
167
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3&active-only=true')
168
- expect(Deprecation).to have_received(:warn)
169
- end
170
- end
171
- end
172
-
173
- context 'without version' do
174
- subject(:active_lifecycle) { routes.active_lifecycle(druid: druid, milestone_name: 'submitted') }
175
-
176
- it 'make the request' do
177
- active_lifecycle
178
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?active-only=true')
179
- expect(Deprecation).not_to have_received(:warn)
180
- end
181
- end
182
-
183
- context 'with version' do
184
- subject(:active_lifecycle) { routes.active_lifecycle(druid: druid, milestone_name: 'submitted', version: 3) }
52
+ subject(:active_lifecycle) { routes.active_lifecycle(druid: druid, milestone_name: 'submitted', version: 3) }
185
53
 
186
- it 'makes the request with the version' do
187
- active_lifecycle
188
- expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3&active-only=true')
189
- expect(Deprecation).not_to have_received(:warn)
190
- end
54
+ it 'makes the request with the version' do
55
+ active_lifecycle
56
+ expect(requestor).to have_received(:request).with('objects/druid:gv054hp4128/lifecycle?version=3&active-only=true')
191
57
  end
192
58
  end
193
59
  end
@@ -12,51 +12,8 @@ RSpec.describe Dor::Workflow::Client::VersionRoutes do
12
12
  let(:druid) { 'druid:123' }
13
13
 
14
14
  describe '#close_version' do
15
- context 'with positional arguments' do
16
- before do
17
- allow(Deprecation).to receive(:warn)
18
- end
19
-
20
- it 'calls the versionClose endpoint with druid' do
21
- routes.close_version(repo, druid)
22
- expect(Deprecation).to have_received(:warn).twice
23
- end
24
-
25
- it 'optionally prevents creation of accessionWF' do
26
- routes.close_version(repo, druid, false)
27
- expect(mock_requestor).to have_received(:request)
28
- .with('objects/druid:123/versionClose?create-accession=false', 'post', '')
29
- expect(Deprecation).to have_received(:warn).twice
30
- end
31
- end
32
-
33
15
  context 'with kwargs' do
34
- it 'calls the versionClose endpoint' do
35
- routes.close_version(druid: druid)
36
- expect(mock_requestor).to have_received(:request)
37
- .with('objects/druid:123/versionClose', 'post', '')
38
- end
39
-
40
- context 'with deprecated repo arg' do
41
- before do
42
- allow(Deprecation).to receive(:warn)
43
- end
44
-
45
- it 'calls the versionClose endpoint' do
46
- routes.close_version(repo: repo, druid: druid)
47
- expect(mock_requestor).to have_received(:request)
48
- .with('objects/druid:123/versionClose', 'post', '')
49
- expect(Deprecation).to have_received(:warn)
50
- end
51
- end
52
-
53
- it 'optionally prevents creation of accessionWF' do
54
- routes.close_version(druid: druid, create_accession_wf: false)
55
- expect(mock_requestor).to have_received(:request)
56
- .with('objects/druid:123/versionClose?create-accession=false', 'post', '')
57
- end
58
-
59
- it 'optionally passes version' do
16
+ it 'passes version' do
60
17
  routes.close_version(druid: druid, version: 3)
61
18
  expect(mock_requestor).to have_received(:request)
62
19
  .with('objects/druid:123/versionClose?version=3', 'post', '')
@@ -68,50 +68,7 @@ RSpec.describe Dor::Workflow::Client do
68
68
  end
69
69
  end
70
70
 
71
- describe '#create_workflow' do
72
- let(:stubs) do
73
- Faraday::Adapter::Test::Stubs.new do |stub|
74
- stub.post("objects/#{@druid}/workflows/etdSubmitWF") { |_env| [201, {}, ''] }
75
- stub.post("objects/#{@druid}/workflows/raiseException") { |_env| raise 'broken' }
76
- stub.post("objects/#{@druid}/workflows/laneIdWF?lane-id=foo_lane") { |_env| [201, {}, ''] }
77
- stub.post("objects/#{@druid}/workflows/versionWF?version=2") { |_env| [201, {}, ''] }
78
- end
79
- end
80
-
81
- before do
82
- allow(Deprecation).to receive(:warn)
83
- end
84
-
85
- it 'requests the workflow by name and return the URL to the workflow' do
86
- client.create_workflow(nil, @druid, 'etdSubmitWF', wf_xml)
87
- expect(Deprecation).to have_received(:warn).twice
88
- end
89
-
90
- it 'raises on an unexpected Exception' do
91
- expect { client.create_workflow(nil, @druid, 'raiseException', wf_xml) }.to raise_error(Exception, 'broken')
92
- expect(Deprecation).to have_received(:warn).twice
93
- end
94
-
95
- it 'sets the lane_id param if provided in options hash' do
96
- client.create_workflow(nil, @druid, 'laneIdWF', wf_xml, lane_id: 'foo_lane')
97
- expect(Deprecation).to have_received(:warn).twice
98
- end
99
- end
100
-
101
71
  describe '#create_workflow_by_name' do
102
- context 'with no args' do
103
- let(:stubs) do
104
- Faraday::Adapter::Test::Stubs.new do |stub|
105
- stub.post("objects/#{@druid}/workflows/etdSubmitWF") { |_env| [201, {}, ''] }
106
- end
107
- end
108
-
109
- it 'requests the workflow by name and return the URL to the workflow' do
110
- expect(Deprecation).to receive(:warn)
111
- client.create_workflow_by_name(@druid, 'etdSubmitWF')
112
- end
113
- end
114
-
115
72
  context 'when an unexpected exception is raised' do
116
73
  let(:stubs) do
117
74
  Faraday::Adapter::Test::Stubs.new do |stub|
@@ -149,72 +106,6 @@ RSpec.describe Dor::Workflow::Client do
149
106
  end
150
107
  end
151
108
 
152
- describe '#update_workflow_status' do
153
- let(:stubs) do
154
- Faraday::Adapter::Test::Stubs.new do |stub|
155
- stub.put("objects/#{@druid}/workflows/etdSubmitWF/registrar-approval?current-status=queued") do |_env|
156
- [201, {}, '{"next_steps":["submit-marc"]}']
157
- end
158
-
159
- stub.put("objects/#{@druid}/workflows/etdSubmitWF/registrar-approval") do |env|
160
- expect(env.body).to eq "<?xml version=\"1.0\"?>\n<process name=\"registrar-approval\" status=\"completed\" elapsed=\"0\" note=\"annotation\" version=\"2\" laneId=\"lane2\"/>\n"
161
- [201, {}, '{"next_steps":["submit-marc"]}']
162
- end
163
-
164
- stub.put("objects/#{@druid}/workflows/errorWF/registrar-approval") do |_env|
165
- [400, {}, '']
166
- end
167
- end
168
- end
169
- before do
170
- allow(Deprecation).to receive(:warn)
171
- end
172
-
173
- it 'should update workflow status and return true if successful' do
174
- expect(client.update_workflow_status(nil, @druid, 'etdSubmitWF', 'registrar-approval', 'completed', version: 2, note: 'annotation', lane_id: 'lane2')).to be_kind_of Dor::Workflow::Response::Update
175
- end
176
-
177
- it 'should return false if the PUT to the DOR workflow service throws an exception' do
178
- expect { client.update_workflow_status(nil, @druid, 'errorWF', 'registrar-approval', 'completed') }.to raise_error(Dor::WorkflowException, /status 400/)
179
- end
180
-
181
- it 'performs a conditional update when current-status is passed as a parameter' do
182
- expect(mock_http_connection).to receive(:put).with("/objects/#{@druid}/workflows/etdSubmitWF/registrar-approval?current-status=queued").and_call_original
183
-
184
- expect(client.update_workflow_status(nil, @druid, 'etdSubmitWF', 'registrar-approval', 'completed', version: 2, note: 'annotation', lane_id: 'lane1', current_status: 'queued')).to be_kind_of Dor::Workflow::Response::Update
185
- end
186
-
187
- it 'should throw exception if invalid status provided' do
188
- expect { client.update_workflow_status(nil, @druid, 'accessionWF', 'publish', 'NOT_VALID_STATUS') }.to raise_error(ArgumentError)
189
- end
190
- end
191
-
192
- describe '#update_workflow_error_status' do
193
- let(:stubs) do
194
- Faraday::Adapter::Test::Stubs.new do |stub|
195
- stub.put("objects/#{@druid}/workflows/etdSubmitWF/reader-approval") do |env|
196
- expect(env.body).to match(/status="error" errorMessage="Some exception" errorText="The optional stacktrace"/)
197
- [201, {}, '{"next_steps":["submit-marc"]}']
198
- end
199
-
200
- stub.put("objects/#{@druid}/workflows/errorWF/reader-approval") do |_env|
201
- [400, {}, '']
202
- end
203
- end
204
- end
205
-
206
- before do
207
- allow(Deprecation).to receive(:warn)
208
- end
209
-
210
- it 'should update workflow status to error and return true if successful' do
211
- client.update_workflow_error_status(nil, @druid, 'etdSubmitWF', 'reader-approval', 'Some exception', error_text: 'The optional stacktrace')
212
- end
213
- it 'should return false if the PUT to the DOR workflow service throws an exception' do
214
- expect { client.update_workflow_error_status(nil, @druid, 'errorWF', 'reader-approval', 'completed') }.to raise_error(Dor::WorkflowException, /status 400/)
215
- end
216
- end
217
-
218
109
  describe '#workflow_template' do
219
110
  subject(:workflow_template) { client.workflow_template('etdSubmitWF') }
220
111
 
@@ -273,40 +164,6 @@ RSpec.describe Dor::Workflow::Client do
273
164
  end
274
165
  let(:xml) { '' }
275
166
 
276
- context 'when repo is provided' do
277
- before do
278
- allow(Deprecation).to receive(:warn)
279
- end
280
- subject { client.workflow_status(repo: repo, druid: druid, workflow: workflow_name, process: step_name) }
281
-
282
- context 'when a single result is returned' do
283
- let(:xml) do
284
- '<workflow><process name="registrar-approval" status="completed" /></workflow>'
285
- end
286
-
287
- it 'returns status as a string' do
288
- expect(subject).to eq('completed')
289
- end
290
- end
291
- end
292
-
293
- context 'with positional arguments' do
294
- before do
295
- allow(Deprecation).to receive(:warn)
296
- end
297
- subject { client.workflow_status(repo, druid, workflow_name, step_name) }
298
-
299
- context 'when a single result is returned' do
300
- let(:xml) do
301
- '<workflow><process name="registrar-approval" status="completed" /></workflow>'
302
- end
303
-
304
- it 'returns status as a string' do
305
- expect(subject).to eq('completed')
306
- end
307
- end
308
- end
309
-
310
167
  context 'when a single result is returned' do
311
168
  let(:xml) do
312
169
  '<workflow><process name="registrar-approval" status="completed" /></workflow>'
@@ -366,85 +223,6 @@ RSpec.describe Dor::Workflow::Client do
366
223
  end
367
224
  end
368
225
 
369
- describe '#workflow_xml' do
370
- before do
371
- allow(Deprecation).to receive(:warn)
372
- end
373
- context 'with positional args' do
374
- subject(:workflow_xml) { client.workflow_xml('dor', 'druid:123', workflow) }
375
-
376
- context 'when a workflow name is provided' do
377
- let(:workflow) { 'etdSubmitWF' }
378
- let(:xml) { '<workflow id="etdSubmitWF"><process name="registrar-approval" status="completed" /></workflow>' }
379
- let(:stubs) do
380
- Faraday::Adapter::Test::Stubs.new do |stub|
381
- stub.get('dor/objects/druid:123/workflows/etdSubmitWF') do |_env|
382
- [200, {}, xml]
383
- end
384
- end
385
- end
386
-
387
- it 'returns the xml for a given repository, druid, and workflow' do
388
- expect(workflow_xml).to eq(xml)
389
- end
390
- end
391
-
392
- context 'when no workflow name is provided' do
393
- let(:workflow) { nil }
394
-
395
- it 'raises an error' do
396
- expect { workflow_xml }.to raise_error ArgumentError
397
- end
398
- end
399
- end
400
- context 'with keyword args' do
401
- subject(:workflow_xml) { client.workflow_xml(druid: 'druid:123', workflow: workflow) }
402
-
403
- # TODO: Remove this `context` block altogether when repos are wiped out for good
404
- context 'when a repo is provided' do
405
- subject(:workflow_xml) { client.workflow_xml(repo: 'dor', druid: 'druid:123', workflow: workflow) }
406
-
407
- let(:workflow) { 'etdSubmitWF' }
408
- let(:xml) { '<workflow id="etdSubmitWF"><process name="registrar-approval" status="completed" /></workflow>' }
409
- let(:stubs) do
410
- Faraday::Adapter::Test::Stubs.new do |stub|
411
- stub.get('dor/objects/druid:123/workflows/etdSubmitWF') do |_env|
412
- [200, {}, xml]
413
- end
414
- end
415
- end
416
-
417
- it 'returns the xml for a given repository, druid, and workflow' do
418
- expect(workflow_xml).to eq(xml)
419
- end
420
- end
421
-
422
- context 'when a workflow name is provided' do
423
- let(:workflow) { 'etdSubmitWF' }
424
- let(:xml) { '<workflow id="etdSubmitWF"><process name="registrar-approval" status="completed" /></workflow>' }
425
- let(:stubs) do
426
- Faraday::Adapter::Test::Stubs.new do |stub|
427
- stub.get('/objects/druid:123/workflows/etdSubmitWF') do |_env|
428
- [200, {}, xml]
429
- end
430
- end
431
- end
432
-
433
- it 'returns the xml for a given repository, druid, and workflow' do
434
- expect(workflow_xml).to eq(xml)
435
- end
436
- end
437
-
438
- context 'when no workflow name is provided' do
439
- let(:workflow) { nil }
440
-
441
- it 'raises an error' do
442
- expect { workflow_xml }.to raise_error ArgumentError
443
- end
444
- end
445
- end
446
- end
447
-
448
226
  describe '#all_workflows_xml' do
449
227
  subject(:all_workflows_xml) { client.all_workflows_xml('druid:123') }
450
228
 
@@ -537,11 +315,11 @@ RSpec.describe Dor::Workflow::Client do
537
315
  end
538
316
 
539
317
  it 'parses out the active lifecycle' do
540
- expect(client.active_lifecycle(druid: @druid, milestone_name: 'released').beginning_of_day).to eq(Time.parse('2010-06-15T16:08:58-0700').beginning_of_day)
318
+ expect(client.active_lifecycle(druid: @druid, milestone_name: 'released', version: '1').beginning_of_day).to eq(Time.parse('2010-06-15T16:08:58-0700').beginning_of_day)
541
319
  end
542
320
 
543
321
  it 'handles missing lifecycle' do
544
- expect(client.active_lifecycle(druid: @druid, milestone_name: 'NOT_FOUND')).to be_nil
322
+ expect(client.active_lifecycle(druid: @druid, milestone_name: 'NOT_FOUND', version: '1')).to be_nil
545
323
  end
546
324
  end
547
325
 
@@ -729,43 +507,15 @@ RSpec.describe Dor::Workflow::Client do
729
507
  end
730
508
  end
731
509
 
732
- context 'with positional args' do
733
- context 'without a version' do
734
- let(:url) { "/objects/#{@druid}/workflows/accessionWF" }
735
-
736
- it 'sends a delete request to the workflow service' do
737
- expect(Deprecation).to receive(:warn).twice
738
- expect(mock_http_connection).to receive(:delete).with(url).and_call_original
739
- client.delete_workflow(nil, @druid, 'accessionWF')
740
- end
741
- end
742
-
743
- context 'with a version' do
744
- let(:url) { "/objects/#{@druid}/workflows/accessionWF?version=5" }
745
-
746
- it 'sends a delete request to the workflow service' do
747
- expect(Deprecation).to receive(:warn)
748
- expect(mock_http_connection).to receive(:delete).with(url).and_call_original
749
- client.delete_workflow(nil, @druid, 'accessionWF', version: 5)
750
- end
751
- end
752
- end
753
-
754
- context 'with kwargs' do
755
- let(:url) { "/objects/#{@druid}/workflows/accessionWF?version=5" }
510
+ let(:url) { "/objects/#{@druid}/workflows/accessionWF?version=5" }
756
511
 
757
- it 'sends a delete request to the workflow service' do
758
- expect(mock_http_connection).to receive(:delete).with(url).and_call_original
759
- client.delete_workflow(druid: @druid, workflow: 'accessionWF', version: 5)
760
- end
512
+ it 'sends a delete request to the workflow service' do
513
+ expect(mock_http_connection).to receive(:delete).with(url).and_call_original
514
+ client.delete_workflow(druid: @druid, workflow: 'accessionWF', version: 5)
761
515
  end
762
516
  end
763
517
 
764
518
  describe '.stale_queued_workflows' do
765
- before do
766
- allow(Deprecation).to receive(:warn)
767
- end
768
-
769
519
  let(:stubs) do
770
520
  Faraday::Adapter::Test::Stubs.new do |stub|
771
521
  stub.get('workflow_queue/all_queued?hours-ago=24&limit=100') do |_env|
@@ -780,8 +530,7 @@ RSpec.describe Dor::Workflow::Client do
780
530
  end
781
531
 
782
532
  it 'returns an Array of Hashes containing each workflow step' do
783
- ah = client.stale_queued_workflows 'dor', hours_ago: 24, limit: 100
784
- expect(Deprecation).to have_received(:warn).once
533
+ ah = client.stale_queued_workflows hours_ago: 24, limit: 100
785
534
  expected = [
786
535
  { workflow: 'accessionWF', step: 'content-metadata', druid: 'dr:123', lane_id: 'lane1' },
787
536
  { workflow: 'assemblyWF', step: 'jp2-create', druid: 'dr:456', lane_id: 'lane2' }
@@ -791,10 +540,6 @@ RSpec.describe Dor::Workflow::Client do
791
540
  end
792
541
 
793
542
  describe '.count_stale_queued_workflows' do
794
- before do
795
- allow(Deprecation).to receive(:warn)
796
- end
797
-
798
543
  let(:stubs) do
799
544
  Faraday::Adapter::Test::Stubs.new do |stub|
800
545
  stub.get('workflow_queue/all_queued?hours-ago=48&count-only=true') do |_env|
@@ -804,16 +549,11 @@ RSpec.describe Dor::Workflow::Client do
804
549
  end
805
550
 
806
551
  it 'returns the number of queued workflow steps' do
807
- expect(client.count_stale_queued_workflows('dor', hours_ago: 48)).to eq(10)
808
- expect(Deprecation).to have_received(:warn).once
552
+ expect(client.count_stale_queued_workflows(hours_ago: 48)).to eq(10)
809
553
  end
810
554
  end
811
555
 
812
556
  describe '.lane_ids' do
813
- before do
814
- allow(Deprecation).to receive(:warn)
815
- end
816
-
817
557
  let(:stubs) do
818
558
  Faraday::Adapter::Test::Stubs.new do |stub|
819
559
  stub.get('workflow_queue/lane_ids?step=accessionWF:shelve') do |_env|
@@ -828,8 +568,7 @@ RSpec.describe Dor::Workflow::Client do
828
568
  end
829
569
 
830
570
  it 'returns the lane ids for a given workflow step' do
831
- expect(client.lane_ids('dor', 'accessionWF', 'shelve')).to eq(%w[lane1 lane2])
832
- expect(Deprecation).to have_received(:warn).once
571
+ expect(client.lane_ids('accessionWF', 'shelve')).to eq(%w[lane1 lane2])
833
572
  end
834
573
  end
835
574
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-28 00:00:00.000000000 Z
12
+ date: 2022-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
282
  requirements: []
283
- rubygems_version: 3.2.32
283
+ rubygems_version: 3.3.7
284
284
  signing_key:
285
285
  specification_version: 4
286
286
  summary: Provides convenience methods to work with the DOR Workflow Service