Skip to content

Commit

Permalink
Merge pull request #195 from sul-dlss/use-create-wf-service
Browse files Browse the repository at this point in the history
Use Dor::CreateWorkflowService over the deprecated Item#initiate_apo_…
  • Loading branch information
mjgiarlo committed Feb 1, 2019
2 parents 644072f + 3212dde commit 9766190
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 9766190

Please sign in to comment.