Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Use a non deprecated workflow update method
Browse files Browse the repository at this point in the history
This prevents the workflow service from logging deprecation notices in honeybadger.
  • Loading branch information
jcoyne committed Sep 23, 2019
1 parent 143f3d6 commit 868b866
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gem 'assembly-objectfile', '~> 1.5'
# or we'll get a superclass mismatch for Hydrus::Item
gem 'dor-services', '~> 7.2', require: false
gem 'dor-services-client', '~> 2.0'
gem 'dor-workflow-client', '~> 3.9'
gem 'rubydora', '~> 2.1'
gem 'bagit', '~> 0.4'
gem 'blacklight', '~> 6.19'
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ GEM
moab-versioning (~> 4.0)
nokogiri (~> 1.8)
zeitwerk (~> 2.1)
dor-workflow-client (3.6.0)
dor-workflow-client (3.9.0)
activesupport (>= 3.2.1, < 7)
deprecation (>= 0.99.0)
faraday (~> 0.9, >= 0.9.2)
Expand Down Expand Up @@ -326,7 +326,7 @@ GEM
mini_exiftool (2.9.0)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.12.0)
moab-versioning (4.2.2)
confstruct
druid-tools (>= 1.0.0)
Expand Down Expand Up @@ -580,6 +580,7 @@ DEPENDENCIES
dlss-capistrano
dor-services (~> 7.2)
dor-services-client (~> 2.0)
dor-workflow-client (~> 3.9)
dynamic_form
equivalent-xml
factory_bot_rails
Expand Down
2 changes: 1 addition & 1 deletion app/models/hydrus/processable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def complete_workflow_step(step)
# Takes the name of a step in the Hydrus workflow.
# Calls the workflow service to mark that step as completed.
def update_workflow_status(step, status)
workflow_client.update_workflow_status(REPO, pid, Dor::Config.hydrus.app_workflow, step, status)
workflow_client.update_status(pid, Dor::Config.hydrus.app_workflow, step, status)
workflows_content_is_stale
end

Expand Down
14 changes: 9 additions & 5 deletions spec/features/models/item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
instance_double(Dor::Workflow::Client,
all_workflows_xml: '',
milestones: [],
update_workflow_status: nil,
update_status: nil,
create_workflow_by_name: nil)
end
before do
Expand All @@ -92,10 +92,14 @@
allow(hi).to receive(:should_start_assembly_wf).and_return(true)
allow(hi).to receive(:is_assemblable).and_return(true)
hi.do_publish()
expect(wfs).to have_received(:update_workflow_status).with('dor', hi.pid,
'hydrusAssemblyWF', 'approve', 'completed')
expect(wfs).to have_received(:update_workflow_status).with('dor', hi.pid,
'hydrusAssemblyWF', 'start-assembly', 'completed')
expect(wfs).to have_received(:update_status).with(druid: hi.pid,
workflow: 'hydrusAssemblyWF',
process: 'approve',
status: 'completed')
expect(wfs).to have_received(:update_status).with(druid: hi.pid,
workflow: 'hydrusAssemblyWF',
process: 'start-assembly',
status: 'completed')
expect(wfs).to have_received(:create_workflow_by_name).with(hi.pid, 'assemblyWF', version: '1')
end
end
Expand Down
9 changes: 6 additions & 3 deletions spec/models/hydrus/processable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

describe 'complete_workflow_step()' do
let(:wfs) { instance_double(Dor::Workflow::Client) }
let(:step) { 'submit' }

before do
allow(Dor::Config.workflow).to receive(:client).and_return(wfs)
end

it 'can exercise the method, stubbing out call to WF service' do
step = 'submit'
args = ['dor', @go.pid, 'hydrusAssemblyWF', step, 'completed']
expect(wfs).to receive(:update_workflow_status).with(*args)
expect(wfs).to receive(:update_status).with(druid: @go.pid,
workflow: 'hydrusAssemblyWF',
process: step,
status: 'completed')
allow(@go).to receive_message_chain(:workflows, :workflow_step_is_done).and_return(false)
expect(@go).to receive(:workflows_content_is_stale)
@go.complete_workflow_step(step)
Expand Down

0 comments on commit 868b866

Please sign in to comment.