Browse Source

feat: respond to PR comments

pull/1218/head
natdeanlewissoftwire 3 years ago
parent
commit
96a9a7a14b
  1. 8
      app/models/validations/sales/sale_information_validations.rb
  2. 4
      config/locales/en.yml
  3. 6
      spec/models/validations/sales/sale_information_validations_spec.rb

8
app/models/validations/sales/sale_information_validations.rb

@ -20,11 +20,11 @@ module Validations::Sales::SaleInformationValidations
case record.type
when 18
record.errors.add :type, "Social HomeBuy buyers should not have lived here before"
record.errors.add :proplen, "Social HomeBuy or Rent to Buy buyers should not have lived here before"
record.errors.add :type, I18n.t("validations.sale_information.proplen.social_homebuy")
record.errors.add :proplen, I18n.t("validations.sale_information.proplen.social_homebuy")
when 28, 29
record.errors.add :type, "Rent to Buy buyers should not have lived here before"
record.errors.add :proplen, "Rent to Buy buyers should not have lived here before"
record.errors.add :type, I18n.t("validations.sale_information.proplen.rent_to_buy")
record.errors.add :proplen, I18n.t("validations.sale_information.proplen.rent_to_buy")
end
end
end

4
config/locales/en.yml

@ -367,6 +367,10 @@ en:
not_internal_transfer: "Answer cannot be ‘permanently decanted from another property owned by this landlord’ as you told us the source of referral for this tenancy was not an internal transfer"
condition_effects:
no_choices: "You cannot answer this question as you told us nobody in the household has a physical or mental health condition (or other illness) expected to last 12 months or more"
sale_information:
proplen:
social_homebuy: "Social HomeBuy buyers should not have lived here before"
rent_to_buy: "Rent to Buy buyers should not have lived here before"
tenancy:
length:

6
spec/models/validations/sales/sale_information_validations_spec.rb

@ -146,7 +146,8 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_years_living_in_property_before_purchase(record)
expect(record.errors).to be_present
expect(record.errors[:type]).to include(I18n.t("validations.sale_information.proplen.rent_to_buy"))
expect(record.errors[:proplen]).to include(I18n.t("validations.sale_information.proplen.rent_to_buy"))
end
end
@ -156,7 +157,8 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_years_living_in_property_before_purchase(record)
expect(record.errors).to be_present
expect(record.errors[:type]).to include(I18n.t("validations.sale_information.proplen.social_homebuy"))
expect(record.errors[:proplen]).to include(I18n.t("validations.sale_information.proplen.social_homebuy"))
end
end
end

Loading…
Cancel
Save