From 4f63bb724b6d0ce89454ef00e9434c3a976c0188 Mon Sep 17 00:00:00 2001 From: Peri McLaren <141954992+pmclaren19@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:10:07 -0700 Subject: [PATCH] updated tests --- .../failure_notification_email_job.rb | 1 - .../failure_notification_email_job_spec.rb | 14 +++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb b/app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb index dec0b2cf036..3ccc25a87fa 100644 --- a/app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb +++ b/app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb @@ -50,7 +50,6 @@ def send_failed_evidence_submissions def record_email_send_success(upload, response) upload.update(va_notify_id: response.id, va_notify_date: DateTime.now) - byebug message = "#{upload.job_class} va notify failure email queued" ::Rails.logger.info(message) StatsD.increment('silent_failure_avoided_no_confirmation', diff --git a/spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb b/spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb index d343a0f4113..129a293eba3 100644 --- a/spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb +++ b/spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb @@ -89,31 +89,23 @@ end context 'when there is 1 FAILED record without a va_notify_date' do - let(:evidence_submission_stub) { instance_double(EvidenceSubmission) } let(:tags) { ['service:claim-status', "function: #{message}"] } let!(:evidence_submission_failed) { create(:bd_evidence_submission_failed) } let(:message) { "#{evidence_submission_failed.job_class} va notify failure email queued" } before do - # allow(VaNotify::Service).to receive(:new) - # allow(EvidenceSubmission).to receive(:va_notify_email_not_queued) - allow(EvidenceSubmission).to receive(:where) - # allow(EvidenceSubmission).to receive(:update) - allow(EvidenceSubmission).to receive(:new).and_return(evidence_submission_stub) - + allow(EvidenceSubmission).to receive(:va_notify_email_not_queued).and_return([evidence_submission_failed]) allow(Rails.logger).to receive(:info) allow(StatsD).to receive(:increment) end it 'successfully enqueues a failure notification mailer to send to the veteran' do expect(EvidenceSubmission.count).to eq(1) - expect(EvidenceSubmission.va_notify_email_queued.length).to eq(0) + expect(EvidenceSubmission.va_notify_email_not_queued.length).to eq(1) expect(vanotify_service).to receive(:send_email) - expect(evidence_submission_stub).to receive(:update) + expect(evidence_submission_failed).to receive(:update).and_call_original expect(Rails.logger).to receive(:info).with(message) expect(StatsD).to receive(:increment).with('silent_failure_avoided_no_confirmation', tags: tags) - expect(EvidenceSubmission.va_notify_email_not_queued.length).to eq(1) - subject.new.perform expect(EvidenceSubmission.va_notify_email_queued.length).to eq(1) end