From b764b42a2eba0bbf99679a63ae036b0591ce3878 Mon Sep 17 00:00:00 2001 From: Daniel Baark <5101747+baarkerlounger@users.noreply.github.com> Date: Tue, 16 Nov 2021 12:00:31 +0000 Subject: [PATCH] Bugfixes (#93) * Update footer email * Page validations need to match form page names * Update specs --- app/validations/household_validations.rb | 2 +- app/views/layouts/_footer.html.erb | 2 +- config/forms/2021_2022.json | 4 ++-- spec/controllers/case_logs_controller_spec.rb | 2 +- spec/features/case_log_spec.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/validations/household_validations.rb b/app/validations/household_validations.rb index d3536ae8a..bb04599c7 100644 --- a/app/validations/household_validations.rb +++ b/app/validations/household_validations.rb @@ -45,7 +45,7 @@ module HouseholdValidations end end - def validate_household_pregnancy(record) + def validate_pregnancy(record) if (record.preg_occ == "Yes" || record.preg_occ == "Prefer not to say") && !women_of_child_bearing_age_in_household(record) record.errors.add :preg_occ, "You must answer no as there are no female tenants aged 16-50 in the property" end diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index ffba80da2..5e0da8f33 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -22,7 +22,7 @@

Email

diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index f7b8e8763..7ae709b1c 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -209,7 +209,7 @@ } } }, - "age1": { + "person_1_age": { "header": "", "description": "", "questions": { @@ -307,7 +307,7 @@ } } }, - "tenant_economic_status": { + "person_1_economic": { "header": "", "description": "", "questions": { diff --git a/spec/controllers/case_logs_controller_spec.rb b/spec/controllers/case_logs_controller_spec.rb index 8192173fc..1b4c1fcf6 100644 --- a/spec/controllers/case_logs_controller_spec.rb +++ b/spec/controllers/case_logs_controller_spec.rb @@ -125,7 +125,7 @@ RSpec.describe CaseLogsController, type: :controller do context "conditional routing" do before do - allow_any_instance_of(CaseLogValidator).to receive(:validate_household_pregnancy).and_return(true) + allow_any_instance_of(CaseLogValidator).to receive(:validate_pregnancy).and_return(true) end let(:case_log_form_conditional_question_yes_params) do diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index a616b7baf..6db2cbe6a 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -449,7 +449,7 @@ RSpec.describe "Test Features" do describe "conditional page routing", js: true do before do - allow_any_instance_of(CaseLogValidator).to receive(:validate_household_pregnancy).and_return(true) + allow_any_instance_of(CaseLogValidator).to receive(:validate_pregnancy).and_return(true) end it "can route the user to a different page based on their answer on the current page" do