From c9050f688d995edba5ea98d4081754a37959791c Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 3 May 2024 11:42:23 +0100 Subject: [PATCH] CLDC-NONE: Remove duplicate word in error message --- config/locales/en.yml | 2 +- .../sale_information_validations_spec.rb | 84 +++++++++---------- .../sales/year2024/row_parser_spec.rb | 2 +- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index dd26d72a5..941c12c52 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -631,7 +631,7 @@ en: must_be_after_hodate: "Sale completion date must be after practical completion or handover date" previous_property_type: property_type_bedsit: "A bedsit cannot have more than 1 bedroom" - discounted_ownership_value: "The mortgage, deposit, and grant when added together is %{mortgage_deposit_and_grant_total}, and the purchase purchase price times by the discount is %{value_with_discount}. These figures should be the same" + discounted_ownership_value: "The mortgage, deposit, and grant when added together is %{mortgage_deposit_and_grant_total}, and the purchase price times by the discount is %{value_with_discount}. These figures should be the same" outright_sale_value: "The mortgage and deposit when added together is %{mortgage_and_deposit_total}, and the purchase price is %{value}. These figures should be the same." monthly_rent: higher_than_expected: "Basic monthly rent must be between £0.00 and £9,999.00" diff --git a/spec/models/validations/sales/sale_information_validations_spec.rb b/spec/models/validations/sales/sale_information_validations_spec.rb index 969f2c16f..bfc9b579c 100644 --- a/spec/models/validations/sales/sale_information_validations_spec.rb +++ b/spec/models/validations/sales/sale_information_validations_spec.rb @@ -242,13 +242,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do record.value = 99_998 record.discount = 50 sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same") end it "adds an error if mortgage, deposit and grant at least 1 less than discounted value" do @@ -258,13 +258,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do record.value = 100_002 record.discount = 50 sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same") end it "does not add an error if mortgage, deposit and grant less than 1 greater than discounted value" do @@ -347,13 +347,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do it "returns true if mortgage and deposit total does not equal market value - discount" do record.discount = 10 sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same") end it "returns false if mortgage and deposit total equals market value - discount" do @@ -376,13 +376,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do it "returns true if mortgage and deposit total does not equal market value" do record.deposit = 2_000 sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same") end it "returns false if mortgage and deposit total equals market value" do @@ -422,13 +422,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do it "returns true if mortgage, grant and deposit total does not equal market value - discount" do record.mortgage = 10 sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") end it "returns false if mortgage, grant and deposit total equals market value - discount" do @@ -450,13 +450,13 @@ RSpec.describe Validations::Sales::SaleInformationValidations do it "returns true if grant and deposit total does not equal market value - discount" do sale_information_validator.validate_discounted_ownership_value(record) - expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") - expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["mortgageused"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["mortgage"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["value"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["deposit"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["ownershipsch"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["discount"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") + expect(record.errors["grant"]).to include("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same") end it "returns false if mortgage, grant and deposit total equals market value - discount" do diff --git a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb index 01206ff12..0ab21e1b0 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -1230,7 +1230,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "only adds errors to the discounted ownership field" do expect(parser.errors[:field_103]).to be_empty - expect(parser.errors[:field_117]).to include("The mortgage, deposit, and grant when added together is £100.00, and the purchase purchase price times by the discount is £90.00. These figures should be the same") + expect(parser.errors[:field_117]).to include("The mortgage, deposit, and grant when added together is £100.00, and the purchase price times by the discount is £90.00. These figures should be the same") expect(parser.errors[:field_126]).to be_empty end end