@ -832,6 +832,11 @@ RSpec.describe Validations::FinancialValidations do
financial_validator . validate_rent_amount ( record )
financial_validator . validate_rent_amount ( record )
expect ( record . errors [ " brent " ] )
expect ( record . errors [ " brent " ] )
. to include ( match I18n . t ( " validations.financial.brent.below_hard_min " ) )
. to include ( match I18n . t ( " validations.financial.brent.below_hard_min " ) )
%w[ beds la postcode_known scheme_id location_id rent_type needstype period ] . each do | field |
expect ( record . errors [ field ] )
. to include ( match I18n . t ( " validations.financial.brent. #{ field } .below_hard_min " ) )
end
end
end
it " validates hard max for general needs " do
it " validates hard max for general needs " do
@ -846,22 +851,11 @@ RSpec.describe Validations::FinancialValidations do
financial_validator . validate_rent_amount ( record )
financial_validator . validate_rent_amount ( record )
expect ( record . errors [ " brent " ] )
expect ( record . errors [ " brent " ] )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
expect ( record . errors [ " beds " ] )
. to include ( match I18n . t ( " validations.financial.brent.beds.above_hard_max " ) )
%w[ beds la postcode_known scheme_id location_id rent_type needstype period ] . each do | field |
expect ( record . errors [ " la " ] )
expect ( record . errors [ field ] )
. to include ( match I18n . t ( " validations.financial.brent.la.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent. #{ field } .above_hard_max " ) )
expect ( record . errors [ " postcode_known " ] )
end
. to include ( match I18n . t ( " validations.financial.brent.postcode_known.above_hard_max " ) )
expect ( record . errors [ " scheme_id " ] )
. to include ( match I18n . t ( " validations.financial.brent.scheme_id.above_hard_max " ) )
expect ( record . errors [ " location_id " ] )
. to include ( match I18n . t ( " validations.financial.brent.location_id.above_hard_max " ) )
expect ( record . errors [ " rent_type " ] )
. to include ( match I18n . t ( " validations.financial.brent.rent_type.above_hard_max " ) )
expect ( record . errors [ " needstype " ] )
. to include ( match I18n . t ( " validations.financial.brent.needstype.above_hard_max " ) )
expect ( record . errors [ " period " ] )
. to include ( match I18n . t ( " validations.financial.brent.period.above_hard_max " ) )
end
end
it " validates hard max for supported housing " do
it " validates hard max for supported housing " do
@ -875,22 +869,11 @@ RSpec.describe Validations::FinancialValidations do
financial_validator . validate_rent_amount ( record )
financial_validator . validate_rent_amount ( record )
expect ( record . errors [ " brent " ] )
expect ( record . errors [ " brent " ] )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
expect ( record . errors [ " beds " ] )
. to include ( match I18n . t ( " validations.financial.brent.beds.above_hard_max " ) )
%w[ beds la postcode_known scheme_id location_id rent_type needstype period ] . each do | field |
expect ( record . errors [ " la " ] )
expect ( record . errors [ field ] )
. to include ( match I18n . t ( " validations.financial.brent.la.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent. #{ field } .above_hard_max " ) )
expect ( record . errors [ " postcode_known " ] )
end
. to include ( match I18n . t ( " validations.financial.brent.postcode_known.above_hard_max " ) )
expect ( record . errors [ " scheme_id " ] )
. to include ( match I18n . t ( " validations.financial.brent.scheme_id.above_hard_max " ) )
expect ( record . errors [ " location_id " ] )
. to include ( match I18n . t ( " validations.financial.brent.location_id.above_hard_max " ) )
expect ( record . errors [ " rent_type " ] )
. to include ( match I18n . t ( " validations.financial.brent.rent_type.above_hard_max " ) )
expect ( record . errors [ " needstype " ] )
. to include ( match I18n . t ( " validations.financial.brent.needstype.above_hard_max " ) )
expect ( record . errors [ " period " ] )
. to include ( match I18n . t ( " validations.financial.brent.period.above_hard_max " ) )
end
end
it " validates hard max for correct collection year " do
it " validates hard max for correct collection year " do
@ -904,14 +887,11 @@ RSpec.describe Validations::FinancialValidations do
financial_validator . validate_rent_amount ( record )
financial_validator . validate_rent_amount ( record )
expect ( record . errors [ " brent " ] )
expect ( record . errors [ " brent " ] )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent.above_hard_max " ) )
expect ( record . errors [ " beds " ] )
. to include ( match I18n . t ( " validations.financial.brent.beds.above_hard_max " ) )
%w[ beds la postcode_known scheme_id location_id rent_type needstype period ] . each do | field |
expect ( record . errors [ " la " ] )
expect ( record . errors [ field ] )
. to include ( match I18n . t ( " validations.financial.brent.la.above_hard_max " ) )
. to include ( match I18n . t ( " validations.financial.brent. #{ field } .above_hard_max " ) )
expect ( record . errors [ " rent_type " ] )
end
. to include ( match I18n . t ( " validations.financial.brent.rent_type.above_hard_max " ) )
expect ( record . errors [ " needstype " ] )
. to include ( match I18n . t ( " validations.financial.brent.needstype.above_hard_max " ) )
end
end
it " does not error if some of the fields are missing " do
it " does not error if some of the fields are missing " do