record.errors.add"person_#{person_num}_economic_status","Tenant #{person_num} economic status must be Child under 16 if their age is under 16"
record.errors.add"person_#{person_num}_economic_status","Tenant #{person_num} economic status must be Child under 16 if their age is under 16"
end
end
ifage>=16&&age<=19&&(economic_status!="Full-time student"||economic_status!="Prefer not to say")
record.errors.add"person_#{person_num}_economic_status","If age is between 16 and 19 - tenant #{person_num} must be a full time student or prefer not to say."
ifage>=16&&age<=19&&relationship=="Child - includes young adult and grown-up"&&(economic_status!="Full-time student"||economic_status!="Prefer not to say")
record.errors.add"person_#{person_num}_economic_status","If age is between 16 and 19 - tenant #{person_num} must be a full time student or prefer not to say."
it"validate that persons aged under 16 must be a child (economically speaking)"do
expect{CaseLog.create!(person_2_age:15,person_2_economic_status:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
end
it"validate that persons aged between 16 and 19 that are a child must be a full time student or economic status refused"do
expect{CaseLog.create!(person_2_age:17,person_2_relationship:"Child - includes young adult and grown-up",person_2_economic_status:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
end
it"validate that persons aged under 16 must be a child relationship"do