diff --git a/app/jobs/doi_verification_job.rb b/app/jobs/doi_verification_job.rb index 5cc28403d..b3136de72 100644 --- a/app/jobs/doi_verification_job.rb +++ b/app/jobs/doi_verification_job.rb @@ -13,6 +13,8 @@ def perform(publication_id) response = UnpaywallClient.query_unpaywall(publication) if publication.matchable_title == response.matchable_title && response.doi.present? publication.update!(doi: response.doi, doi_verified: true) + else + publication.update!(doi_verified: false) end end end diff --git a/spec/component/jobs/doi_verification_job_spec.rb b/spec/component/jobs/doi_verification_job_spec.rb index e7ee96d16..e6ce6d4c5 100644 --- a/spec/component/jobs/doi_verification_job_spec.rb +++ b/spec/component/jobs/doi_verification_job_spec.rb @@ -67,8 +67,8 @@ expect(publication.reload.doi).to be_nil end - it 'does not update the doi verification' do - expect(publication.reload.doi_verified).to be_nil + it 'updates the doi verification to false' do + expect(publication.reload.doi_verified).to be false end end end @@ -83,8 +83,8 @@ expect(publication.reload.doi).to be_nil end - it 'does not update the doi verification' do - expect(publication.reload.doi_verified).to be_nil + it 'updates the doi verification to false' do + expect(publication.reload.doi_verified).to be false end end end