Skip to content

Commit

Permalink
Use Dor::CreateWorkflowService over the deprecated Item#initiate_apo_…
Browse files Browse the repository at this point in the history
…workflow
  • Loading branch information
jcoyne committed Jan 30, 2019
1 parent ed268af commit 3212dde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/objects_controller.rb
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions spec/controllers/objects_controller_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3212dde

Please sign in to comment.