diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb index 1a2c61138..9dc8828e8 100644 --- a/app/models/validations/soft_validations.rb +++ b/app/models/validations/soft_validations.rb @@ -16,13 +16,13 @@ module Validations::SoftValidations }.freeze def net_income_in_soft_max_range? - return unless weekly_net_income && ecstat1 && hhmemb + return unless weekly_net_income && ecstat1 && hhmemb && applicable_income_range weekly_net_income.between?(applicable_income_range.soft_max, applicable_income_range.hard_max) end def net_income_in_soft_min_range? - return unless weekly_net_income && ecstat1 && hhmemb + return unless weekly_net_income && ecstat1 && hhmemb && applicable_income_range weekly_net_income.between?(applicable_income_range.hard_min, applicable_income_range.soft_min) end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index 357d661b7..01529a80b 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -1915,6 +1915,15 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do expect(parser.errors.where(:field_125, category: :soft_validation).first.message).to eql("You told us the rent is £120.00 every week. This is higher than we would expect.") end end + + context "when an invalid ecstat1 is given" do + let(:attributes) { setup_section_params.merge({ field_46: 11, field_119: 123, field_118: 1 }) } + + it "does not run net income soft validations validation" do + parser.valid? + expect(parser.errors.where(:field_46).count).to be(1) + end + end end describe "log_already_exists?" do