From 780f0892c48cdf157b46d55793c4f6cf0dfc4fcf Mon Sep 17 00:00:00 2001 From: Ted Date: Fri, 29 Apr 2022 12:00:24 +0100 Subject: [PATCH] Fix other reason for leaving last settled validation --- app/models/validations/household_validations.rb | 2 +- spec/models/validations/household_validations_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index 5d0f52037..34f5f5862 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -18,7 +18,7 @@ module Validations::HouseholdValidations record.errors.add :underoccupation_benefitcap, I18n.t("validations.household.underoccupation_benefitcap.dont_know_required") record.errors.add :reason, I18n.t("validations.household.underoccupation_benefitcap.dont_know_required") end - validate_other_field(record, 31, :reason, :reasonother) + validate_other_field(record, 20, :reason, :reasonother) if record.is_reason_permanently_decanted? && record.referral.present? && !record.is_internal_transfer? record.errors.add :referral, I18n.t("validations.household.referral.reason_permanently_decanted") diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb index 6fdf72dc9..8d33a44f4 100644 --- a/spec/models/validations/household_validations_spec.rb +++ b/spec/models/validations/household_validations_spec.rb @@ -120,7 +120,7 @@ RSpec.describe Validations::HouseholdValidations do let(:field) { "validations.other_field_missing" } it "validates that a reason is provided" do - record.reason = 31 + record.reason = 20 record.reasonother = nil household_validator.validate_reason_for_leaving_last_settled_home(record) expect(record.errors["reasonother"]) @@ -128,7 +128,7 @@ RSpec.describe Validations::HouseholdValidations do end it "expects that a reason is provided" do - record.reason = 31 + record.reason = 20 record.reasonother = "Some unusual reason" household_validator.validate_reason_for_leaving_last_settled_home(record) expect(record.errors["reasonother"]).to be_empty