diff --git a/app/jobs/reports/identity_verification_report.rb b/app/jobs/reports/identity_verification_report.rb index e3c335649f5..f002aaf2c3f 100644 --- a/app/jobs/reports/identity_verification_report.rb +++ b/app/jobs/reports/identity_verification_report.rb @@ -16,20 +16,19 @@ def perform(report_date) save_report(REPORT_NAME, csv, extension: 'csv') - if emails.empty? + email = IdentityConfig.store.team_ada_email + if email.blank? Rails.logger.warn 'No email addresses received - Identity Verification Report NOT SENT' return false end - emails.each do |email| - ReportMailer.tables_report( - email: email, - subject: "Daily Identity Verification Report - #{report_date.to_date}", - reports: reports, - message: message, - attachment_format: :xlsx, - ).deliver_now - end + ReportMailer.tables_report( + email: email, + subject: "Daily Identity Verification Report - #{report_date.to_date}", + reports: reports, + message: message, + attachment_format: :xlsx, + ).deliver_now end def message @@ -53,10 +52,6 @@ def preamble HTML end - def emails - [IdentityConfig.store.team_ada_email].compact - end - def reports [report_maker.identity_verification_emailable_report] end diff --git a/spec/jobs/reports/identity_verification_report_spec.rb b/spec/jobs/reports/identity_verification_report_spec.rb index 3303cf97d9d..982e7ea6a18 100644 --- a/spec/jobs/reports/identity_verification_report_spec.rb +++ b/spec/jobs/reports/identity_verification_report_spec.rb @@ -64,7 +64,7 @@ end it 'does not send report in email if the email field is empty' do - allow(IdentityConfig.store).to receive(:team_ada_email).and_return(nil) + allow(IdentityConfig.store).to receive(:team_ada_email).and_return('') report_maker = double( Reporting::IdentityVerificationReport,