From 691eff1e30931b4fce90d410f8f41a2553b41f83 Mon Sep 17 00:00:00 2001 From: Ian Perera Date: Wed, 6 Mar 2024 16:58:02 -0500 Subject: [PATCH] Disable user profile email in form 40-0247 --- .../services/simple_forms_api/confirmation_email.rb | 8 +------- .../spec/services/confirmation_email_spec.rb | 12 ++---------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/modules/simple_forms_api/app/services/simple_forms_api/confirmation_email.rb b/modules/simple_forms_api/app/services/simple_forms_api/confirmation_email.rb index 3de2247f6c6..e289b5db6f7 100644 --- a/modules/simple_forms_api/app/services/simple_forms_api/confirmation_email.rb +++ b/modules/simple_forms_api/app/services/simple_forms_api/confirmation_email.rb @@ -74,7 +74,7 @@ def form_specific_data when 'vba_40_0247' return unless Flipper.enabled?(:form40_0247_confirmation_email) - form40_0247_contact_info(@form_data) + [@form_data['applicant_email'], @form_data.dig('applicant_full_name', 'first')] else [nil, nil] end @@ -131,11 +131,5 @@ def form21_10210_contact_info(form_data) [nil, nil] end end - - def form40_0247_contact_info(form_data) - # email address is optional field - # when email is not entered, use current user's email - [form_data['applicant_email'].presence || @user&.va_profile_email, form_data.dig('applicant_full_name', 'first')] - end end end diff --git a/modules/simple_forms_api/spec/services/confirmation_email_spec.rb b/modules/simple_forms_api/spec/services/confirmation_email_spec.rb index 02890ba3ed9..74938305781 100644 --- a/modules/simple_forms_api/spec/services/confirmation_email_spec.rb +++ b/modules/simple_forms_api/spec/services/confirmation_email_spec.rb @@ -144,7 +144,7 @@ context 'when user is signed in' do let(:user) { create(:user, :loa3) } - it 'sends the confirmation email' do + it 'does not send the confirmation email' do allow(VANotify::EmailJob).to receive(:perform_async) expect(data['applicant_email']).to be_nil @@ -157,15 +157,7 @@ subject.send - expect(VANotify::EmailJob).to have_received(:perform_async).with( - user.va_profile_email, - 'form40_0247_confirmation_email_template_id', - { - 'first_name' => 'JOE', - 'date_submitted' => Time.zone.today.strftime('%B %d, %Y'), - 'confirmation_number' => 'confirmation_number' - } - ) + expect(VANotify::EmailJob).not_to have_received(:perform_async) end end