Browse Source

move validation string to locales

pull/1278/head
Phil Lee 3 years ago
parent
commit
84b0aa6e0a
  1. 4
      app/services/bulk_upload/lettings/row_parser.rb
  2. 1
      config/locales/en.yml
  3. 1
      spec/services/bulk_upload/lettings/row_parser_spec.rb

4
app/services/bulk_upload/lettings/row_parser.rb

@ -185,9 +185,7 @@ private
def leaving_reason_for_renewal
if field_134 == 1 && ![40, 42].include?(field_52)
message = 'The reason for leaving must be "End of assured shorthold tenancy - no fault" or "End of fixed term tenancy - no fault" if the letting is a renewal'
errors.add(:field_52, message)
errors.add(:field_52, I18n.t("validations.household.reason.renewal_reason_needed"))
end
end

1
config/locales/en.yml

@ -376,6 +376,7 @@ en:
male_refuge: "Answer cannot be ‘male’ as you told us their housing situation immediately before this letting was a refuge"
reason:
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"
renewal_reason_needed: 'The reason for leaving must be "End of assured shorthold tenancy - no fault" or "End of fixed term tenancy - no fault" if the letting is a renewal'
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"
postcode:

1
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -272,7 +272,6 @@ RSpec.describe BulkUpload::Lettings::RowParser do
let(:attributes) { { bulk_upload:, field_52: "1", field_134: "1" } }
it "is not permitted" do
parser.field_52 = "1"
expect(parser.errors[:field_52]).to be_present
end
end

Loading…
Cancel
Save