Browse Source

refactor: remove duplicated copy

pull/1225/head
natdeanlewissoftwire 3 years ago
parent
commit
8f6f13d658
  1. 2
      app/models/validations/sales/sale_information_validations.rb
  2. 2
      config/locales/en.yml
  3. 2
      spec/models/validations/sales/sale_information_validations_spec.rb

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

@ -39,7 +39,7 @@ module Validations::Sales::SaleInformationValidations
return unless record.fromprop && record.frombeds return unless record.fromprop && record.frombeds
if record.frombeds != 1 && record.fromprop == 2 if record.frombeds != 1 && record.fromprop == 2
record.errors.add :frombeds, I18n.t("validations.sale_information.previous_property_beds.property_type_bedsit") record.errors.add :frombeds, I18n.t("validations.sale_information.previous_property_type.property_type_bedsit")
record.errors.add :fromprop, I18n.t("validations.sale_information.previous_property_type.property_type_bedsit") record.errors.add :fromprop, I18n.t("validations.sale_information.previous_property_type.property_type_bedsit")
end end
end end

2
config/locales/en.yml

@ -437,8 +437,6 @@ en:
must_be_less_than_1_year_from_exdate: "Completion date must be less than 1 year after contract exchange date" must_be_less_than_1_year_from_exdate: "Completion date must be less than 1 year after contract exchange date"
must_be_less_than_3_years_from_hodate: "You told us completion date is more than 3 years after practical completion or handover date" must_be_less_than_3_years_from_hodate: "You told us completion date is more than 3 years after practical completion or handover date"
must_be_after_hodate: "Completion date must be after practical completion or handover date" must_be_after_hodate: "Completion date must be after practical completion or handover date"
previous_property_beds:
property_type_bedsit: "Bedsit bedroom maximum 1"
previous_property_type: previous_property_type:
property_type_bedsit: "A bedsit cannot have more than 1 bedroom" property_type_bedsit: "A bedsit cannot have more than 1 bedroom"
discounted_ownership_value: "Mortgage, deposit, and grant total must equal £%{value_with_discount}" discounted_ownership_value: "Mortgage, deposit, and grant total must equal £%{value_with_discount}"

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

@ -166,7 +166,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "does add an error if it's a bedsit" do it "does add an error if it's a bedsit" do
sale_information_validator.validate_previous_property_unit_type(record) sale_information_validator.validate_previous_property_unit_type(record)
expect(record.errors["fromprop"]).to include(I18n.t("validations.sale_information.previous_property_type.property_type_bedsit")) expect(record.errors["fromprop"]).to include(I18n.t("validations.sale_information.previous_property_type.property_type_bedsit"))
expect(record.errors["frombeds"]).to include(I18n.t("validations.sale_information.previous_property_beds.property_type_bedsit")) expect(record.errors["frombeds"]).to include(I18n.t("validations.sale_information.previous_property_type.property_type_bedsit"))
end end
end end
end end

Loading…
Cancel
Save