diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb
index 0b871fce0..e56a16783 100644
--- a/app/models/validations/household_validations.rb
+++ b/app/models/validations/household_validations.rb
@@ -35,12 +35,6 @@ module Validations::HouseholdValidations
end
end
- def validate_pregnancy(record)
- if (record.has_pregnancy? || record.pregnancy_refused?) && women_in_household(record) && !women_of_child_bearing_age_in_household(record)
- record.errors.add :preg_occ, I18n.t("validations.household.preg_occ.no_female")
- end
- end
-
def validate_household_number_of_other_members(record)
(2..8).each do |n|
validate_person_age_matches_economic_status(record, n)
diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb
index fc2c469ca..a96e39898 100644
--- a/app/models/validations/soft_validations.rb
+++ b/app/models/validations/soft_validations.rb
@@ -57,7 +57,7 @@ module Validations::SoftValidations
end
def female_in_pregnant_household_in_soft_validation_range?
- all_tenants_age_and_gender_information_completed? && (females_in_age_range(11, 15) || females_in_age_range(51, 65)) && !females_in_age_range(16, 50) && preg_occ == 1
+ all_tenants_age_and_gender_information_completed? && females_in_the_household? && !females_in_age_range(16, 50) && preg_occ == 1
end
def all_tenants_age_and_gender_information_completed?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a7a5e5400..7e514b17f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -335,8 +335,6 @@ en:
leftreg:
question_required: "Tell us whether the person is still serving in the UK armed forces as you told us they’re a current or former regular"
question_not_required: "You cannot answer whether the person is still serving in the UK armed forces as you told us they’re not a current or former regular"
- preg_occ:
- no_female: "Enter ‘no’ as there are no female tenants aged 11-65 in the household"
age:
retired_male: "A male tenant who is retired must be 65 or over"
retired_female: "A female tenant who is retired must be 60 or over"
@@ -516,7 +514,7 @@ en:
pregnancy:
title: "You told us somebody in the household is pregnant"
no_females: "You also told us there are no female tenants living at the property."
- females_not_in_soft_age_range: "You also told us that any female tenants living at the property are in the following age ranges:
"
+ females_not_in_soft_age_range: "You also told us that any female tenants living at the property are in the following age ranges:- under 16 years old
- over 50 years old
"
major_repairs_date:
title_text: "You told us the time between the start of the tenancy and the major repairs completion date is more than 2 years"
void_date:
diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb
index daa3feef1..e1837a43d 100644
--- a/spec/models/validations/household_validations_spec.rb
+++ b/spec/models/validations/household_validations_spec.rb
@@ -60,73 +60,6 @@ RSpec.describe Validations::HouseholdValidations do
end
end
- describe "pregnancy validations" do
- context "when there are no female tenants" do
- it "validates that pregnancy can be yes" do
- record.preg_occ = 1
- record.sex1 = "M"
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"]).to be_empty
- end
-
- it "validates that pregnancy can be prefer not to say" do
- record.preg_occ = 3
- record.sex1 = "M"
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"]).to be_empty
- end
- end
-
- context "when there are female tenants" do
- context "but they are older than 65" do
- before { record.assign_attributes(sex1: "F", age1: 66, preg_occ: 1) }
-
- it "validates that pregnancy cannot be yes" do
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"])
- .to include(match I18n.t("validations.household.preg_occ.no_female"))
- end
- end
-
- context "and they are the lead tenant and under 65" do
- before { record.assign_attributes(sex1: "F", age1: 64, preg_occ: 1) }
-
- it "allows pregnancy to be set to yes" do
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"]).to be_empty
- end
- end
-
- context "and they are another household member and under 51" do
- before { record.assign_attributes(sex1: "M", age1: 25, sex3: "F", age3: 64, preg_occ: 1) }
-
- it "allows pregnancy to be set to yes" do
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"]).to be_empty
- end
- end
-
- context "and they are another household member and under 11" do
- before { record.assign_attributes(sex1: "M", age1: 25, sex3: "F", age3: 10, preg_occ: 1) }
-
- it "validates that pregnancy cannot be yes" do
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"])
- .to include(match I18n.t("validations.household.preg_occ.no_female"))
- end
- end
-
- context "and one tenant's age is unknown" do
- before { record.assign_attributes(sex1: "F", age1: nil, age1_known: 1, preg_occ: 1) }
-
- it "allows pregnancy to be set to yes" do
- household_validator.validate_pregnancy(record)
- expect(record.errors["preg_occ"]).to be_empty
- end
- end
- end
- end
-
describe "reason for leaving last settled home validations" do
let(:field) { "validations.other_field_not_required" }
let(:main_field_label) { "reason" }
diff --git a/spec/models/validations/soft_validations_spec.rb b/spec/models/validations/soft_validations_spec.rb
index b71d91a62..137073c77 100644
--- a/spec/models/validations/soft_validations_spec.rb
+++ b/spec/models/validations/soft_validations_spec.rb
@@ -175,14 +175,14 @@ RSpec.describe Validations::SoftValidations do
end
end
- context "when female tenants are in 11-16 age range" do
+ context "when female tenants are under 16" do
it "shows the interruption screen" do
record.update!(age2: 14, sex2: "F", preg_occ: 1, hhmemb: 2, details_known_2: 0, age2_known: 0, age1: 18, sex1: "M", age1_known: 0)
expect(record.female_in_pregnant_household_in_soft_validation_range?).to be true
end
end
- context "when female tenants are in 50-65 age range" do
+ context "when female tenants are over 50" do
it "shows the interruption screen" do
record.update!(age1: 54, sex1: "F", preg_occ: 1, hhmemb: 1, age1_known: 0)
expect(record.female_in_pregnant_household_in_soft_validation_range?).to be true