Skip to content

Commit

Permalink
Merge pull request #3405 from sul-dlss/structural-update
Browse files Browse the repository at this point in the history
Call the update API with a DRO not a DROStructural
  • Loading branch information
jcoyne authored Apr 7, 2022
2 parents 42ec84f + 494a35e commit 94d5f7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/jobs/import_structural_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def perform(_batch_id, params)
result = StructureUpdater.from_csv(cocina_item, item_csv(csv.headers, grouped.fetch(druid)))

if result.success?
Dor::Services::Client.object(druid).update(params: result.value!)
Dor::Services::Client.object(druid).update(params: cocina_item.new(structural: result.value!))
success.call("Updated #{druid}")
else
failure.call("Unable to update #{druid}")
Expand Down
4 changes: 2 additions & 2 deletions spec/jobs/import_structural_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
end

it 'updates the structural for each druid' do
expect(object_client1).to have_received(:update)
expect(object_client2).to have_received(:update)
expect(object_client1).to have_received(:update).with(params: Cocina::Models::DRO)
expect(object_client2).to have_received(:update).with(params: Cocina::Models::DRO)
expect(bulk_action.druid_count_total).to eq 2
expect(bulk_action.druid_count_success).to eq 2
expect(bulk_action.druid_count_fail).to eq 0
Expand Down

0 comments on commit 94d5f7c

Please sign in to comment.