Skip to content

fix error in report job where nil email array returns false#10577

Merged
theabrad merged 3 commits intomainfrom
abrad-identity-report-fix
May 10, 2024
Merged

fix error in report job where nil email array returns false#10577
theabrad merged 3 commits intomainfrom
abrad-identity-report-fix

Conversation

@theabrad
Copy link
Contributor

@theabrad theabrad commented May 9, 2024

🛠 Summary of changes

Fix an error in IdentityVerificationReport job where a nil email array returns false when it should return true to not send out the email.

changelog: Internal, IdV, Fix error Identity report job with empty email array
@theabrad theabrad requested review from a team and aduth May 9, 2024 16:12
save_report(REPORT_NAME, csv, extension: 'csv')

if emails.empty?
if emails.compact.empty?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I might suggest moving this into the def emails method itself, since I doubt we'd ever want to deal with a [nil] array from that method
  2. Could we add some regression test coverage for this?

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)

expect(ReportMailer).to_not receive(:tables_report)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test passes without the changes. I think we're missing a call to actually perform the job?

Suggested change
expect(ReportMailer).to_not receive(:tables_report)
expect(ReportMailer).to_not receive(:tables_report)
subject.perform(report_date)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants