|
|
|
@ -335,11 +335,11 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
record.ecstat2 = 1 |
|
|
|
|
household_validator.validate_household_number_of_other_members(record) |
|
|
|
|
expect(record.errors["ecstat2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.ecstat.not_student_16_19", person_num: 2)) |
|
|
|
|
.to include(match I18n.t("validations.household.ecstat.student_16_19.must_be_student", person_num: 2)) |
|
|
|
|
expect(record.errors["age2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.age.not_student_16_19", person_num: 2)) |
|
|
|
|
.to include(match I18n.t("validations.household.age.student_16_19.cannot_be_16_19.child_not_student", person_num: 2)) |
|
|
|
|
expect(record.errors["relat2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.relat.not_student_16_19", person_num: 2)) |
|
|
|
|
.to include(match I18n.t("validations.household.relat.student_16_19.cannot_be_child.16_19_not_student", person_num: 2)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "expects that person can be a full time student" do |
|
|
|
@ -363,6 +363,39 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not add an error for a person aged 16-19 who is a student but not a child of the lead tenant" do |
|
|
|
|
record.age2 = 18 |
|
|
|
|
record.ecstat2 = "7" |
|
|
|
|
record.relat2 = "P" |
|
|
|
|
household_validator.validate_household_number_of_other_members(record) |
|
|
|
|
expect(record.errors["relat2"]).to be_empty |
|
|
|
|
expect(record.errors["ecstat2"]).to be_empty |
|
|
|
|
expect(record.errors["age2"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not add an error for a person not aged 16-19 who is a student but not a child of the lead tenant" do |
|
|
|
|
record.age2 = 20 |
|
|
|
|
record.ecstat2 = "7" |
|
|
|
|
record.relat2 = "P" |
|
|
|
|
household_validator.validate_household_number_of_other_members(record) |
|
|
|
|
expect(record.errors["relat2"]).to be_empty |
|
|
|
|
expect(record.errors["ecstat2"]).to be_empty |
|
|
|
|
expect(record.errors["age2"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "adds errors for a person who is a child of the lead tenant and a student but not aged 16-19" do |
|
|
|
|
record.age2 = 14 |
|
|
|
|
record.ecstat2 = "7" |
|
|
|
|
record.relat2 = "C" |
|
|
|
|
household_validator.validate_household_number_of_other_members(record) |
|
|
|
|
expect(record.errors["relat2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.relat.student_16_19.cannot_be_child.student_not_16_19")) |
|
|
|
|
expect(record.errors["age2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.age.student_16_19.must_be_16_19")) |
|
|
|
|
expect(record.errors["ecstat2"]) |
|
|
|
|
.to include(match I18n.t("validations.household.ecstat.student_16_19.cannot_be_student.child_not_16_19")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the household contains a person over 70" do |
|
|
|
|
it "expects that person under 70 does not need to be retired" do |
|
|
|
|
record.age2 = 50 |
|
|
|
|