diff --git a/app/controllers/objects_controller.rb b/app/controllers/objects_controller.rb index 47db1b93c..23e37540c 100644 --- a/app/controllers/objects_controller.rb +++ b/app/controllers/objects_controller.rb @@ -81,7 +81,7 @@ def apo_workflows "#{params[:wf_name]}WF" end - @item.initiate_apo_workflow(workflow) + Dor::CreateWorkflowService.create_workflow(@item, name: workflow) head :created end diff --git a/spec/controllers/objects_controller_spec.rb b/spec/controllers/objects_controller_spec.rb index ab3639031..f4ddca25c 100644 --- a/spec/controllers/objects_controller_spec.rb +++ b/spec/controllers/objects_controller_spec.rb @@ -138,13 +138,14 @@ end describe 'apo-workflow intialization' do - it 'initiates accessionWF via obj.initiate_apo_workflow' do - expect(item).to receive(:initiate_apo_workflow).with('assemblyWF') + it 'initiates assemblyWF' do + expect(Dor::CreateWorkflowService).to receive(:create_workflow).with(item, name: 'assemblyWF') + post 'apo_workflows', params: { id: item.pid, wf_name: 'assemblyWF' } end it "handles workflow names without 'WF' appended to the end" do - expect(item).to receive(:initiate_apo_workflow).with('accessionWF') + expect(Dor::CreateWorkflowService).to receive(:create_workflow).with(item, name: 'accessionWF') post 'apo_workflows', params: { id: item.pid, wf_name: 'accession' } end end