From 73caaec705df23da121d40152630e9b080337845 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 26 Sep 2024 13:28:40 +0100 Subject: [PATCH] Update more hard coded BU errors --- .../lettings/year2023/row_parser.rb | 22 +++++----- .../lettings/year2024/row_parser.rb | 22 +++++----- .../bulk_upload/sales/year2023/row_parser.rb | 18 ++++---- .../bulk_upload/sales/year2024/row_parser.rb | 16 +++---- .../interruption_screen_helper_spec.rb | 4 +- .../bulk_upload/lettings/validator_spec.rb | 2 +- .../lettings/year2023/row_parser_spec.rb | 44 +++++++++---------- .../lettings/year2024/row_parser_spec.rb | 40 ++++++++--------- .../bulk_upload/sales/validator_spec.rb | 2 +- .../sales/year2023/row_parser_spec.rb | 12 ++--- .../sales/year2024/row_parser_spec.rb | 22 +++++----- 11 files changed, 102 insertions(+), 102 deletions(-) diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 5fb11c46e..481b399dd 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -555,7 +555,7 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found") + errors.add(:field_3, "User with the specified email could not be found.") end end @@ -565,7 +565,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation") + errors.add(:field_3, "User must be related to owning organisation or managing organisation.") end def assigned_to @@ -780,7 +780,7 @@ private def validate_related_location_exists if scheme && location_id.present? && location.nil? && location_field.present? block_log_creation! - errors.add(location_field, "#{location_or_scheme.capitalize} code must relate to a #{location_or_scheme} that is owned by the owning organisation or managing organisation", category: :setup) + errors.add(location_field, "#{location_or_scheme.capitalize} code must relate to a #{location_or_scheme} that is owned by the owning organisation or managing organisation.", category: :setup) end end @@ -794,7 +794,7 @@ private def validate_related_scheme_exists if scheme_id.present? && scheme_field.present? && owning_organisation.present? && managing_organisation.present? && scheme.nil? block_log_creation! - errors.add(scheme_field, "This #{scheme_or_management_group} code does not belong to the owning organisation or managing organisation", category: :setup) + errors.add(scheme_field, "This #{scheme_or_management_group} code does not belong to the owning organisation or managing organisation.", category: :setup) end end @@ -810,7 +810,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation", category: :setup) + errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation.", category: :setup) end end end @@ -820,7 +820,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "The managing organisation code is incorrect", category: :setup) + errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) end end end @@ -828,7 +828,7 @@ private def validate_managing_org_data_given if field_2.blank? block_log_creation! - errors.add(:field_2, "The managing organisation code is incorrect", category: :setup) + errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) end end @@ -837,7 +837,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock", category: :setup) + errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) end end end @@ -847,7 +847,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect", category: :setup) + errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) end end end @@ -864,7 +864,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) + errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) end end end @@ -887,7 +887,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." errors.add(:field_1, error_message) # owning_organisation errors.add(:field_7, error_message) # startdate diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 4df67a21e..3a18ac633 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -579,7 +579,7 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found") + errors.add(:field_3, "User with the specified email could not be found.") end end @@ -595,7 +595,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation") + errors.add(:field_3, "User must be related to owning organisation or managing organisation.") end def assigned_to @@ -832,14 +832,14 @@ private def validate_related_location_exists if scheme && field_6.present? && location.nil? && :field_6.present? block_log_creation! - errors.add(:field_6, "Location code must relate to a location that is owned by the owning organisation or managing organisation", category: :setup) + errors.add(:field_6, "Location code must relate to a location that is owned by the owning organisation or managing organisation.", category: :setup) end end def validate_related_scheme_exists if field_5.present? && :field_5.present? && owning_organisation.present? && managing_organisation.present? && scheme.nil? block_log_creation! - errors.add(:field_5, "This scheme code does not belong to the owning organisation or managing organisation", category: :setup) + errors.add(:field_5, "This scheme code does not belong to the owning organisation or managing organisation.", category: :setup) end end @@ -848,7 +848,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation", category: :setup) + errors.add(:field_2, "This managing organisation does not have a relationship with the owning organisation.", category: :setup) end end end @@ -858,7 +858,7 @@ private block_log_creation! if field_2.present? && errors[:field_2].blank? - errors.add(:field_2, "The managing organisation code is incorrect", category: :setup) + errors.add(:field_2, "The managing organisation code is incorrect.", category: :setup) end end end @@ -875,7 +875,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock", category: :setup) + errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) end end end @@ -885,7 +885,7 @@ private block_log_creation! if field_1.present? && errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect", category: :setup) + errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) end end end @@ -906,9 +906,9 @@ private return if errors[:field_1].present? if bulk_upload.user.support? - errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}", category: :setup) + errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}.", category: :setup) else - errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) + errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) end end @@ -943,7 +943,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." errors.add(:field_1, error_message) # owning_organisation errors.add(:field_8, error_message) # startdate diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index fe0bd6fd5..715a8983a 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -1158,7 +1158,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect", category: :setup) + errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) end end end @@ -1168,7 +1168,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect", category: :setup) + errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) end end end @@ -1178,7 +1178,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock", category: :setup) + errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) end end end @@ -1188,7 +1188,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) + errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) end end end @@ -1197,7 +1197,7 @@ private return if field_2.blank? unless assigned_to - errors.add(:field_2, "User with the specified email could not be found") + errors.add(:field_2, "User with the specified email could not be found.") end end @@ -1207,7 +1207,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_2, "User must be related to owning organisation or managing organisation", category: :setup) + errors.add(:field_2, "User must be related to owning organisation or managing organisation.", category: :setup) end def managing_organisation @@ -1221,7 +1221,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This user belongs to an organisation that does not have a relationship with the owning organisation", category: :setup) + errors.add(:field_2, "This user belongs to an organisation that does not have a relationship with the owning organisation.", category: :setup) end end end @@ -1296,7 +1296,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." errors.add(:field_1, error_message) # Owning org errors.add(:field_3, error_message) # Sale completion date @@ -1331,7 +1331,7 @@ private def validate_buyer1_economic_status if field_35 == 9 - errors.add(:field_35, "Buyer 1 cannot be a child under 16") + errors.add(:field_35, "Buyer 1 cannot be a child under 16.") end end end diff --git a/app/services/bulk_upload/sales/year2024/row_parser.rb b/app/services/bulk_upload/sales/year2024/row_parser.rb index 907b4b23a..df1a06528 100644 --- a/app/services/bulk_upload/sales/year2024/row_parser.rb +++ b/app/services/bulk_upload/sales/year2024/row_parser.rb @@ -1287,7 +1287,7 @@ private block_log_creation! if field_1.present? && errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code is incorrect", category: :setup) + errors.add(:field_1, "The owning organisation code is incorrect.", category: :setup) end end end @@ -1297,7 +1297,7 @@ private block_log_creation! if errors[:field_1].blank? - errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock", category: :setup) + errors.add(:field_1, "The owning organisation code provided is for an organisation that does not own stock.", category: :setup) end end end @@ -1311,9 +1311,9 @@ private return if errors[:field_1].present? if bulk_upload.user.support? - errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}", category: :setup) + errors.add(:field_1, "This owning organisation is not affiliated with #{bulk_upload_organisation.name}.", category: :setup) else - errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) + errors.add(:field_1, "You do not have permission to add logs for this owning organisation.", category: :setup) end end @@ -1321,7 +1321,7 @@ private return if field_3.blank? unless assigned_to - errors.add(:field_3, "User with the specified email could not be found") + errors.add(:field_3, "User with the specified email could not be found.") end end @@ -1337,7 +1337,7 @@ private return if assigned_to.organisation == owning_organisation&.absorbing_organisation || assigned_to.organisation == managing_organisation&.absorbing_organisation block_log_creation! - errors.add(:field_3, "User must be related to owning organisation or managing organisation", category: :setup) + errors.add(:field_3, "User must be related to owning organisation or managing organisation.", category: :setup) end def managing_organisation @@ -1357,7 +1357,7 @@ private block_log_creation! if errors[:field_2].blank? - errors.add(:field_2, "This organisation does not have a relationship with the owning organisation", category: :setup) + errors.add(:field_2, "This organisation does not have a relationship with the owning organisation.", category: :setup) end end end @@ -1432,7 +1432,7 @@ private def validate_if_log_already_exists if log_already_exists? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." errors.add(:field_1, error_message) # Owning org errors.add(:field_4, error_message) # Sale completion date diff --git a/spec/helpers/interruption_screen_helper_spec.rb b/spec/helpers/interruption_screen_helper_spec.rb index cd044e61a..60cd71131 100644 --- a/spec/helpers/interruption_screen_helper_spec.rb +++ b/spec/helpers/interruption_screen_helper_spec.rb @@ -151,7 +151,7 @@ RSpec.describe InterruptionScreenHelper do }, ], } - expect(display_informative_text(informative_text_hash, lettings_log)).to eq("You said this: £12,345.00") + expect(display_informative_text(informative_text_hash, lettings_log)).to eq("You said this: £12,345.00.") end end @@ -216,7 +216,7 @@ RSpec.describe InterruptionScreenHelper do }, ], } - expect(display_title_text(title_text, lettings_log)).to eq("You said this: £12,345.00") + expect(display_title_text(title_text, lettings_log)).to eq("You said this: £12,345.00.") end end end diff --git a/spec/services/bulk_upload/lettings/validator_spec.rb b/spec/services/bulk_upload/lettings/validator_spec.rb index 5c6cabd81..a8773b63d 100644 --- a/spec/services/bulk_upload/lettings/validator_spec.rb +++ b/spec/services/bulk_upload/lettings/validator_spec.rb @@ -179,7 +179,7 @@ RSpec.describe BulkUpload::Lettings::Validator do end it "creates errors" do - expect { validator.call }.to change(BulkUploadError.where(category: :setup, error: "This is a duplicate of a log in your file"), :count) + expect { validator.call }.to change(BulkUploadError.where(category: :setup, error: "This is a duplicate of a log in your file."), :count) end end diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index f5ceaf014..18c28189a 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -263,7 +263,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -300,7 +300,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -338,7 +338,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -385,7 +385,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -444,7 +444,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -479,7 +479,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -526,7 +526,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -585,7 +585,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -979,7 +979,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_17]).to be_blank end end @@ -1018,7 +1018,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank - expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) end end @@ -1054,7 +1054,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank - expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) end end @@ -1067,7 +1067,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_17]).to be_blank end end @@ -1122,7 +1122,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank end @@ -1147,7 +1147,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation."]) expect(parser.errors[:field_17]).to be_blank end end @@ -1173,7 +1173,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? expect(parser.errors[:field_15]).to be_blank - expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation."]) expect(parser.errors[:field_17]).to be_blank end end @@ -1186,7 +1186,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "returns a setup error" do parser.valid? - expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank end @@ -1543,7 +1543,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect.") end it "blocks log creation" do @@ -1561,7 +1561,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") end it "blocks log creation" do @@ -1579,7 +1579,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation.") end it "blocks log creation" do @@ -1642,7 +1642,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") end it "blocks log creation" do @@ -1658,7 +1658,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") end it "blocks log creation" do @@ -1676,7 +1676,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation.") end it "blocks log creation" do 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 a0c4bd26a..3910e1281 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -283,7 +283,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -339,7 +339,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -381,7 +381,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -432,7 +432,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -492,7 +492,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -527,7 +527,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -574,7 +574,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "adds an error to all the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -634,7 +634,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not add an error to all the fields used to determine duplicates" do parser_too.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # owning_organisation @@ -932,7 +932,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S123", field_6: location.id } } it "returns a setup error" do - expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_6]).to be_blank end end @@ -952,7 +952,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) end end @@ -981,7 +981,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank - expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation."]) end end @@ -991,7 +991,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{other_scheme.id}", field_6: other_location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "returns a setup error" do - expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) + expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation."]) expect(parser.errors[:field_6]).to be_blank end end @@ -1071,7 +1071,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "is not permitted" do parser.valid? - expect(parser.errors[:field_98]).to include('The reason for leaving must be "End of social or private sector tenancy - no fault", "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)", "End of social or private sector tenancy - evicted due to rent arrears" or "End of social or private sector tenancy - evicted for any other reason"') + expect(parser.errors[:field_98]).to include('The reason for leaving must be "End of social or private sector tenancy - no fault", "End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)", "End of social or private sector tenancy - evicted due to rent arrears" or "End of social or private sector tenancy - evicted for any other reason".') end end end @@ -1365,7 +1365,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect.") end it "blocks log creation" do @@ -1384,7 +1384,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") end it "blocks log creation" do @@ -1403,7 +1403,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation.") end it "blocks log creation" do @@ -1472,7 +1472,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do parser = described_class.new(attributes) parser.valid? expect(parser).to be_block_log_creation - expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation") + expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation.") end end @@ -1490,7 +1490,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "does not block log creation and does not add an error to field_1" do parser = described_class.new(attributes) parser.valid? - expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation") + expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation.") end end end @@ -1521,7 +1521,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect.") end it "blocks log creation" do @@ -1540,7 +1540,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation.") end it "blocks log creation" do diff --git a/spec/services/bulk_upload/sales/validator_spec.rb b/spec/services/bulk_upload/sales/validator_spec.rb index 2698d0a34..f968f5661 100644 --- a/spec/services/bulk_upload/sales/validator_spec.rb +++ b/spec/services/bulk_upload/sales/validator_spec.rb @@ -199,7 +199,7 @@ RSpec.describe BulkUpload::Sales::Validator do end it "creates errors" do - expect { validator.call }.to change(BulkUploadError.where(category: :setup, error: "This is a duplicate of a log in your file"), :count).by(20) + expect { validator.call }.to change(BulkUploadError.where(category: :setup, error: "This is a duplicate of a log in your file."), :count).by(20) end end end diff --git a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb index efdf23d3a..7d7c62885 100644 --- a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb @@ -432,7 +432,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: unaffiliated_org.old_visible_id } } it "is not permitted as setup error" do - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation"]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation."]) end it "blocks log creation" do @@ -661,7 +661,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # Owning org @@ -969,7 +969,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { valid_attributes.merge({ field_35: "9" }) } it "a custom validation is applied" do - validation_message = "Buyer 1 cannot be a child under 16" + validation_message = "Buyer 1 cannot be a child under 16." expect(parser.errors[:field_35]).to include validation_message end end @@ -1121,7 +1121,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do it "only adds errors to the discounted ownership field" do expect(parser.errors[:field_105]).to be_empty - expect(parser.errors[:field_119]).to include("Mortgage, deposit, and grant total must equal £90.00. Your given mortgage, deposit and grant total is £100.00") + expect(parser.errors[:field_119]).to include("Mortgage, deposit, and grant total must equal £90.00. Your given mortgage, deposit and grant total is £100.00.") expect(parser.errors[:field_128]).to be_empty end end @@ -1409,7 +1409,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This user belongs to an organisation that does not have a relationship with the owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This user belongs to an organisation that does not have a relationship with the owning organisation.") end it "blocks log creation" do @@ -1431,7 +1431,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") end it "blocks log creation" 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 aa3a60b4f..b74545a9a 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -467,7 +467,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted as a setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["The owning organisation code is incorrect"]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["The owning organisation code is incorrect."]) end it "blocks log creation" do @@ -483,7 +483,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "is not permitted as setup error" do parser.valid? - expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation"]) + expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You do not have permission to add logs for this owning organisation."]) end it "blocks log creation" do @@ -570,7 +570,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser = described_class.new(attributes) parser.valid? expect(parser).to be_block_log_creation - expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation") + expect(parser.errors[:field_1]).to include("You do not have permission to add logs for this owning organisation.") end end @@ -588,7 +588,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "does not block log creation and does not add an error to field_1" do parser = described_class.new(attributes) parser.valid? - expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation") + expect(parser.errors[:field_1]).not_to include("You do not have permission to add logs for this owning organisation.") end end end @@ -782,7 +782,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "adds an error to all (and only) the fields used to determine duplicates" do parser.valid? - error_message = "This is a duplicate log" + error_message = "This is a duplicate log." [ :field_1, # Owning org @@ -871,7 +871,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct error" do parser.valid? - expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%") + expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%.") end end @@ -889,7 +889,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "returns correct error" do parser.valid? - expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%") + expect(parser.errors.where(:field_116).map(&:message)).to include("Percentage discount must be between 0% and 70%.") end end end @@ -1209,7 +1209,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 2’s age must be between 16 and 110" + validation_message = "Buyer 2’s age must be between 16 and 110." expect(parser.errors[:field_38]).to include validation_message end end @@ -1255,7 +1255,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do it "a custom validation is applied" do parser.valid? - validation_message = "Buyer 1’s age must be between 16 and 110" + validation_message = "Buyer 1’s age must be between 16 and 110." expect(parser.errors[:field_31]).to include validation_message end end @@ -1997,7 +1997,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This organisation does not have a relationship with the owning organisation") + expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This organisation does not have a relationship with the owning organisation.") end it "blocks log creation" do @@ -2019,7 +2019,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do parser.valid? setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock") + expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock.") end it "blocks log creation" do