Skip to content

Commit

Permalink
Merge pull request #198 from curationexperts/cleanup
Browse files Browse the repository at this point in the history
Fix bug preventing newly imported file from appearing in UI
  • Loading branch information
mark-dce authored Apr 30, 2024
2 parents 5e03b10 + eb5c444 commit 772b3cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Item < Resource
private

def solr_base_values
files_ssm = { 'files_ssm' => files_attachments.map { |file| file.signed_id }.presence }.compact
files_ssm = { 'files_ssm' => files.map(&:signed_id).presence }.compact
super.merge(files_ssm)
end
end
12 changes: 9 additions & 3 deletions spec/jobs/import_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
expect(filenames).to eq ['local_file.png', 'remote_file.png']
expect(filesizes).to eq [2878, 2878]
end

it 'indexes them to Solr' do
solr_client = RSolr::Client.new(nil)
job.process_record(doc_with_files)
signed_ids = Item.last.files.map(&:signed_id)
fragment = signed_ids.join('","')
expect(solr_client).to have_received(:update).with(hash_including(data: match(fragment)))
end
end
end

Expand Down Expand Up @@ -91,9 +99,7 @@

it 'updates the ingest record processed record count', :aggregate_failures do
allow(job).to receive(:process_record).and_return({ status: 'created' })
expect(ingest.processed).to eq 0
job.perform_now
expect(ingest.processed).to eq 2
expect { job.perform_now }.to change(ingest, :processed).from(0).to(2)
end

context 'with errors' do
Expand Down

0 comments on commit 772b3cb

Please sign in to comment.