Skip to content

Commit

Permalink
update to use new start accession method
Browse files Browse the repository at this point in the history
  • Loading branch information
peetucket committed Apr 6, 2020
1 parent 82c899f commit 02c5872
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 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 @@ -156,7 +156,7 @@ def start_accession
description: 'pre-assembly re-accession',
opening_user_name: bundle.bundle_context.user.sunet_id
}
object_client.accession(version_params)
object_client.accession.start(version_params)
end
end
end
21 changes: 12 additions & 9 deletions spec/lib/pre_assembly/digital_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,29 +335,32 @@ def add_object_files(extension = 'tif', all_files_public: false)

describe '#start_accession' do
subject(:start_accession) { object.send(:start_accession) }
subject(:version_params) {

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

let(:version_params) do
{
significance: 'major',
description: 'pre-assembly re-accession',
opening_user_name: bc.user.sunet_id
}
}
before do
allow(Dor::Services::Client).to receive(:object).and_return(object_client)
allow(object).to receive(:druid).and_return(druid)
end

let(:version_client) { instance_double(Dor::Services::Client::ObjectVersion, current: '5') }
let(:object_client) { instance_double(Dor::Services::Client::Object, version: version_client) }
let(:accession_object) { instance_double(Dor::Services::Client::Accession, start: true) }
let(:object_client) { instance_double(Dor::Services::Client::Object, version: version_client, accession: accession_object) }
let(:service_url) { Settings.dor_services_url }

context 'when api client is successful' do
before do
allow(object_client).to receive(:accession).and_return(true)
allow(object_client.accession).to receive(:start).and_return(true)
end

it 'starts accession' do
start_accession
expect(object_client).to have_received(:accession).with(version_params)
expect(object_client.accession).to have_received(:start).with(version_params)
end
end

Expand Down

0 comments on commit 02c5872

Please sign in to comment.