Browse Source

Fix managing org question id

pull/2538/head
Rachael Booth 2 years ago
parent
commit
acf1bcf962
  1. 2
      app/models/validations/financial_validations.rb
  2. 2
      spec/models/validations/financial_validations_spec.rb
  3. 2
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

2
app/models/validations/financial_validations.rb

@ -153,7 +153,7 @@ module Validations::FinancialValidations
org_name: record.managing_organisation.name, org_name: record.managing_organisation.name,
rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase, rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase,
) )
record.errors.add :managing_organisation, :skip_bu_error, message: I18n.t( record.errors.add :managing_organisation_id, :skip_bu_error, message: I18n.t(
"validations.financial.rent_period.invalid_for_org.managing_org", "validations.financial.rent_period.invalid_for_org.managing_org",
org_name: record.managing_organisation.name, org_name: record.managing_organisation.name,
rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase, rent_period: record.form.get_question("period", record).label_from_value(record.period).downcase,

2
spec/models/validations/financial_validations_spec.rb

@ -169,7 +169,7 @@ RSpec.describe Validations::FinancialValidations do
org_name: user.organisation.name, org_name: user.organisation.name,
rent_period: "every 4 weeks", rent_period: "every 4 weeks",
)) ))
expect(record.errors["managing_organisation"]) expect(record.errors["managing_organisation_id"])
.to include(match I18n.t( .to include(match I18n.t(
"validations.financial.rent_period.invalid_for_org.managing_org", "validations.financial.rent_period.invalid_for_org.managing_org",
org_name: user.organisation.name, org_name: user.organisation.name,

2
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -758,7 +758,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "does not add that error" do it "does not add that error" do
parser.valid? parser.valid?
expect(parser.log.errors.map(&:attribute).sort).to eql(%i[managing_organisation period]) expect(parser.log.errors.map(&:attribute).sort).to eql(%i[managing_organisation_id period])
expect(parser.errors.map(&:attribute)).to eql(%i[field_123]) expect(parser.errors.map(&:attribute)).to eql(%i[field_123])
end end
end end

Loading…
Cancel
Save