From 1fc928c75cf70e261feeb220230b617722e7310a Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Wed, 4 Sep 2024 15:15:28 -0400 Subject: [PATCH] LG-12736 | Use strip_nbsp instead of .tr(' ', ' ') (#11193) * LG-12736 | Use strip_nbsp instead of confusing .tr call [skip changelog] * Move file after apparent typo --- .../doc_auth/redo_document_capture_spec.rb | 20 ++++++++++------- spec/features/idv/end_to_end_idv_spec.rb | 2 +- .../idv/hybrid_mobile/hybrid_mobile_spec.rb | 8 +++---- spec/features/idv/in_person_spec.rb | 12 +++++----- .../idv/in_person_threatmetrix_spec.rb | 4 ++-- .../in_person/state_id_controller_spec.rb | 8 ++++--- .../idv/steps/in_person/state_id_step_spec.rb | 8 ++++--- .../idv/steps/in_person_opt_in_ipp_spec.rb | 22 +++++++++++-------- spec/support/features/idv_step_helper.rb | 2 +- ...ep_tags_helper.rb => strip_tags_helper.rb} | 0 10 files changed, 50 insertions(+), 36 deletions(-) rename spec/support/features/{step_tags_helper.rb => strip_tags_helper.rb} (100%) diff --git a/spec/features/idv/doc_auth/redo_document_capture_spec.rb b/spec/features/idv/doc_auth/redo_document_capture_spec.rb index 4f7d8df97cc..f31492795d8 100644 --- a/spec/features/idv/doc_auth/redo_document_capture_spec.rb +++ b/spec/features/idv/doc_auth/redo_document_capture_spec.rb @@ -35,10 +35,12 @@ expect(page).to have_css( '[role="status"]', - text: t( - 'doc_auth.headings.capture_scan_warning_html', - link_html: warning_link_text, - ).tr(' ', ' '), + text: strip_nbsp( + t( + 'doc_auth.headings.capture_scan_warning_html', + link_html: warning_link_text, + ), + ), ) click_link warning_link_text @@ -86,10 +88,12 @@ expect(page).to have_css( '[role="status"]', - text: t( - 'doc_auth.headings.capture_scan_warning_html', - link_html: warning_link_text, - ).tr(' ', ' '), + text: strip_nbsp( + t( + 'doc_auth.headings.capture_scan_warning_html', + link_html: warning_link_text, + ), + ), ) click_link warning_link_text diff --git a/spec/features/idv/end_to_end_idv_spec.rb b/spec/features/idv/end_to_end_idv_spec.rb index e986678e377..8757ec07bdc 100644 --- a/spec/features/idv/end_to_end_idv_spec.rb +++ b/spec/features/idv/end_to_end_idv_spec.rb @@ -209,7 +209,7 @@ def validate_document_capture_page # Check for expected content expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_id')) - expect(page).to have_content(t('doc_auth.headings.document_capture').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('doc_auth.headings.document_capture'))) end def validate_document_capture_submit(user) diff --git a/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb b/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb index 7ee08561b25..99637e6dbd2 100644 --- a/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb +++ b/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb @@ -68,7 +68,7 @@ attach_and_submit_images expect(page).to have_current_path(idv_hybrid_mobile_capture_complete_url) - expect(page).to have_content(t('doc_auth.headings.capture_complete').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('doc_auth.headings.capture_complete'))) expect(page).to have_text(t('doc_auth.instructions.switch_back')) expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_id')) @@ -161,7 +161,7 @@ submit_images expect(page).to have_current_path(idv_hybrid_mobile_capture_complete_url) - expect(page).to have_content(t('doc_auth.headings.capture_complete').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('doc_auth.headings.capture_complete'))) expect(page).to have_text(t('doc_auth.instructions.switch_back')) expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_id')) @@ -275,7 +275,7 @@ attach_and_submit_images expect(page).to have_current_path(idv_hybrid_mobile_capture_complete_url) - expect(page).not_to have_content(t('doc_auth.headings.capture_complete').tr(' ', ' ')) + expect(page).not_to have_content(strip_nbsp(t('doc_auth.headings.capture_complete'))) expect(page).to have_text(t('doc_auth.instructions.switch_back')) end @@ -308,7 +308,7 @@ click_idv_continue expect(page).to have_current_path(idv_hybrid_mobile_capture_complete_url) - expect(page).to have_content(t('doc_auth.headings.capture_complete').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('doc_auth.headings.capture_complete'))) expect(page).to have_text(t('doc_auth.instructions.switch_back')) end diff --git a/spec/features/idv/in_person_spec.rb b/spec/features/idv/in_person_spec.rb index b9e298a8016..19ed370d0a1 100644 --- a/spec/features/idv/in_person_spec.rb +++ b/spec/features/idv/in_person_spec.rb @@ -32,9 +32,11 @@ t('step_indicator.flows.idv.verify_info'), ) expect(page).to have_content( - t( - 'in_person_proofing.headings.state_id_milestone_2', - ).tr(' ', ' '), + strip_nbsp( + t( + 'in_person_proofing.headings.state_id_milestone_2', + ), + ), ) complete_state_id_step(user) @@ -126,7 +128,7 @@ UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] expect(page).to have_css("img[alt='#{APP_NAME}']") - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content(t('in_person_proofing.body.barcode.deadline', deadline: deadline)) expect(page).to have_content('MILWAUKEE') @@ -480,7 +482,7 @@ enrollment_code = JSON.parse( UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content( t('in_person_proofing.body.barcode.deadline', deadline: deadline), diff --git a/spec/features/idv/in_person_threatmetrix_spec.rb b/spec/features/idv/in_person_threatmetrix_spec.rb index 2eb65629dc0..7b4745487cc 100644 --- a/spec/features/idv/in_person_threatmetrix_spec.rb +++ b/spec/features/idv/in_person_threatmetrix_spec.rb @@ -48,7 +48,7 @@ def deactivate_profile_update_enrollment(status:) expect_in_person_step_indicator_current_step( t('step_indicator.flows.idv.go_to_the_post_office'), ) - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_current_path(idv_in_person_ready_to_verify_path) end @@ -150,7 +150,7 @@ def deactivate_profile_update_enrollment(status:) enrollment_code = JSON.parse( UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content( t('in_person_proofing.body.barcode.deadline', deadline: deadline), diff --git a/spec/features/idv/steps/in_person/state_id_controller_spec.rb b/spec/features/idv/steps/in_person/state_id_controller_spec.rb index 0c96f623ebe..d61427536d6 100644 --- a/spec/features/idv/steps/in_person/state_id_controller_spec.rb +++ b/spec/features/idv/steps/in_person/state_id_controller_spec.rb @@ -15,9 +15,11 @@ expect(page).to have_content(t('forms.buttons.continue')) expect(page).to have_content( - t( - 'in_person_proofing.headings.state_id_milestone_2', - ).tr(' ', ' '), + strip_nbsp( + t( + 'in_person_proofing.headings.state_id_milestone_2', + ), + ), ) end diff --git a/spec/features/idv/steps/in_person/state_id_step_spec.rb b/spec/features/idv/steps/in_person/state_id_step_spec.rb index adab4cc66ef..64b2264bfbf 100644 --- a/spec/features/idv/steps/in_person/state_id_step_spec.rb +++ b/spec/features/idv/steps/in_person/state_id_step_spec.rb @@ -15,9 +15,11 @@ expect(page).to have_content(t('forms.buttons.continue')) expect(page).to have_content( - t( - 'in_person_proofing.headings.state_id_milestone_2', - ).tr(' ', ' '), + strip_nbsp( + t( + 'in_person_proofing.headings.state_id_milestone_2', + ), + ), ) end diff --git a/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb b/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb index 187219c52c4..14be95d501a 100644 --- a/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb +++ b/spec/features/idv/steps/in_person_opt_in_ipp_spec.rb @@ -111,7 +111,7 @@ enrollment_code = JSON.parse( UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content( t('in_person_proofing.body.barcode.deadline', deadline: deadline), @@ -150,9 +150,11 @@ t('step_indicator.flows.idv.verify_info'), ) expect(page).to have_content( - t( - 'in_person_proofing.headings.state_id_milestone_2', - ).tr(' ', ' '), + strip_nbsp( + t( + 'in_person_proofing.headings.state_id_milestone_2', + ), + ), ) complete_state_id_step(user) @@ -248,7 +250,7 @@ UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] expect(page).to have_css("img[alt='#{APP_NAME}']") - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content( t( @@ -333,9 +335,11 @@ t('step_indicator.flows.idv.verify_info'), ) expect(page).to have_content( - t( - 'in_person_proofing.headings.state_id_milestone_2', - ).tr(' ', ' '), + strip_nbsp( + t( + 'in_person_proofing.headings.state_id_milestone_2', + ), + ), ) complete_state_id_step(user) @@ -408,7 +412,7 @@ UspsInPersonProofing::Mock::Fixtures.request_enroll_response, )['enrollmentCode'] expect(page).to have_css("img[alt='#{APP_NAME}']") - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) expect(page).to have_content(Idv::InPerson::EnrollmentCodeFormatter.format(enrollment_code)) expect(page).to have_content( t( diff --git a/spec/support/features/idv_step_helper.rb b/spec/support/features/idv_step_helper.rb index 527fd63cc1b..e6a6011b541 100644 --- a/spec/support/features/idv_step_helper.rb +++ b/spec/support/features/idv_step_helper.rb @@ -60,7 +60,7 @@ def visit_help_center end def click_what_to_bring_link - expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' ')) + expect(page).to have_content(strip_nbsp(t('in_person_proofing.headings.barcode'))) click_link t('in_person_proofing.body.barcode.learn_more') end diff --git a/spec/support/features/step_tags_helper.rb b/spec/support/features/strip_tags_helper.rb similarity index 100% rename from spec/support/features/step_tags_helper.rb rename to spec/support/features/strip_tags_helper.rb