Skip to content

Commit

Permalink
Submit current version when starting a workflow
Browse files Browse the repository at this point in the history
Not submitting a version is deprecated
  • Loading branch information
jcoyne committed Jan 16, 2020
1 parent e70881b commit b2f2624
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/lib/pre_assembly/digital_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def create_new_version

# Call web service to add assemblyWF to the object in DOR.
def initialize_assembly_workflow
Dor::Config.workflow.client.create_workflow_by_name(druid.druid, 'assemblyWF')
Dor::Config.workflow.client.create_workflow_by_name(druid.druid, 'assemblyWF', current_version: current_object_version)
end
end
end
5 changes: 4 additions & 1 deletion spec/lib/pre_assembly/digital_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,20 @@ def add_object_files(extension = 'tif')
subject(:start_workflow) { object.send(:initialize_assembly_workflow) }

before do
allow(Dor::Services::Client).to receive(:object).and_return(object_client)
allow(Dor::Config.workflow).to receive(:client).and_return(client)
allow(object).to receive(:druid).and_return(druid)
end

let(:client) { instance_double(Dor::Workflow::Client, create_workflow_by_name: true) }
let(:version_client) { instance_double(Dor::Services::Client::ObjectVersion, current: '5') }
let(:object_client) { instance_double(Dor::Services::Client::Object, version: version_client) }
let(:service_url) { Settings.dor_services_url }

context 'when api client is successful' do
it 'starts the assembly workflow' do
start_workflow
expect(client).to have_received(:create_workflow_by_name).with(druid.druid, 'assemblyWF')
expect(client).to have_received(:create_workflow_by_name).with(druid.druid, 'assemblyWF', current_version: 5)
end
end

Expand Down

0 comments on commit b2f2624

Please sign in to comment.