From f978fb5778cc05fda7b965a256dae592601eb116 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 24 Jun 2020 12:03:53 +0200 Subject: [PATCH] fix MR comments --- .../user_managing_medical_releases_spec.rb | 62 ++++++++++++++----- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/spec/features/user_managing_medical_releases_spec.rb b/spec/features/user_managing_medical_releases_spec.rb index 2c3032e..59510fb 100644 --- a/spec/features/user_managing_medical_releases_spec.rb +++ b/spec/features/user_managing_medical_releases_spec.rb @@ -36,13 +36,13 @@ feature "User managing medical releases" do visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template) - expect(page).not_to have_content('GUARDIAN INFORMATION') - expect(page).not_to have_content('GUARDIAN PHOTO') + expect(page).not_to have_content guardian_information_heading.upcase + expect(page).not_to have_content guardian_photo_heading.upcase page.check person_is_minor_checkbox - expect(page).to have_content('GUARDIAN INFORMATION') - expect(page).to have_content('GUARDIAN PHOTO') - expect(page).to have_content 'Guardian Email' + expect(page).to have_content guardian_information_heading.upcase + expect(page).to have_content guardian_photo_heading.upcase + expect(page).to have_content guardian_email_field.titleize fill_in guardian_first_name_field, with: 'Guardian' fill_in guardian_last_name_field, with: 'Name' @@ -58,7 +58,7 @@ feature "User managing medical releases" do fill_in guardian_email_field, with: 'invalid@email' click_button submit_release_button - expect(page).to have_content('Guardian email is not an email') + expect(page).to have_content email_validation_error_for('Guardian') fill_in guardian_email_field, with: 'valid@email.com' fill_in_guardian_address_fields @@ -77,19 +77,19 @@ feature "User managing medical releases" do visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template) - expect(page).not_to have_content('SECOND GUARDIAN INFORMATION') - expect(page).not_to have_content('SECOND GUARDIAN PHOTO') + expect(page).not_to have_content guardian_2_information_heading.upcase + expect(page).not_to have_content guardian_2_photo_heading.upcase page.check person_is_minor_checkbox - expect(page).to have_content('GUARDIAN INFORMATION') - expect(page).to have_content('GUARDIAN PHOTO') - expect(page).to have_content 'Guardian Email' + expect(page).to have_content guardian_information_heading.upcase + expect(page).to have_content guardian_photo_heading.upcase + expect(page).to have_content guardian_email_field.titleize - expect(page).to have_content 'SECOND GUARDIAN INFORMATION' - expect(page).to have_content 'SECOND GUARDIAN PHOTO' - expect(page).to have_content 'Second Guardian Email' - expect(page).to have_content 'Second Guardian Phone' - expect(page).to have_content 'Second Guardian Address' + expect(page).to have_content guardian_2_information_heading.upcase + expect(page).to have_content guardian_2_photo_heading.upcase + expect(page).to have_content guardian_2_email_field.titleize + expect(page).to have_content guardian_2_phone_field.titleize + expect(page).to have_content guardian_2_address_street1_field.titleize fill_in guardian_first_name_field, with: 'Guardian' fill_in guardian_last_name_field, with: 'Name' @@ -105,7 +105,7 @@ feature "User managing medical releases" do fill_in guardian_email_field, with: 'invalid@email' click_button submit_release_button - expect(page).to have_content('Guardian email is not an email') + expect(page).to have_content email_validation_error_for('Guardian') fill_in guardian_email_field, with: 'valid@email.com' fill_in_guardian_address_fields @@ -368,4 +368,32 @@ feature "User managing medical releases" do def guardian_2_phone_field t('helpers.label.medical_release.guardian_2_phone') end + + def guardian_2_email_field + t('helpers.label.medical_release.guardian_2_email') + end + + def guardian_2_address_street1_field + t('helpers.label.medical_release.guardian_2_address_street1') + end + + def email_validation_error_for(prefix) + "#{prefix} email is not an email" + end + + def guardian_photo_heading + t 'public.medical_releases.new.guardian_photo.heading' + end + + def guardian_information_heading + t 'public.medical_releases.new.guardian_info.heading' + end + + def guardian_2_photo_heading + t 'public.medical_releases.new.guardian_2_photo.heading' + end + + def guardian_2_information_heading + t 'public.medical_releases.new.guardian_2_info.heading' + end end