Browse Source

Update copy and methods

pull/1508/head
Jack S 3 years ago
parent
commit
d2db2db366
  1. 2
      app/models/validations/household_validations.rb
  2. 4
      spec/models/validations/household_validations_spec.rb

2
app/models/validations/household_validations.rb

@ -121,7 +121,7 @@ module Validations::HouseholdValidations
end
end
def validate_housing_needs(record)
def validate_combination_of_housing_needs_responses(record)
if record.housingneeds == 1 && record.housingneeds_type == 3 && record.housingneeds_other&.zero?
record.errors.add :housingneeds, I18n.t("validations.household.housingneeds.invalid")
record.errors.add :housingneeds_type, I18n.t("validations.household.housingneeds.invalid")

4
spec/models/validations/household_validations_spec.rb

@ -639,12 +639,12 @@ RSpec.describe Validations::HouseholdValidations do
end
describe "housing needs validations" do
it "is invalid when housingneeds == 1 && housingneeds_type == 3 && housingneeds_other == 0" do
it "is invalid when a combination of housingneeds == 1 (yes) && housingneeds_type == 3 (none of listed) && housingneeds_other == 0 (no)" do
record.housingneeds = 1
record.housingneeds_type = 3
record.housingneeds_other = 0
household_validator.validate_housing_needs(record)
household_validator.validate_combination_of_housing_needs_responses(record)
error_message = ["If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs"]

Loading…
Cancel
Save