Browse Source

CLDC-3633 Full stops in error messages (#2628)

* Make full stops consistent in error messages

* Fix test

* Update few hardcoded errors

* Update join in remaining row parsers

* Update some more tests

* Update more hard coded BU errors

* Fix typo I introduced - bedrooms to bedroom

---------

Co-authored-by: Kat <katrina@kosiak.co.uk>
Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com>
pull/2644/head^2
Manny Dinssa 3 months ago committed by GitHub
parent
commit
53c3b3e61a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/controllers/auth/sessions_controller.rb
  2. 24
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  3. 24
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  4. 20
      app/services/bulk_upload/sales/year2023/row_parser.rb
  5. 18
      app/services/bulk_upload/sales/year2024/row_parser.rb
  6. 715
      config/locales/en.yml
  7. 4
      spec/helpers/interruption_screen_helper_spec.rb
  8. 2
      spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb
  9. 4
      spec/models/form/lettings/questions/declaration_spec.rb
  10. 2
      spec/models/form/lettings/questions/offered_spec.rb
  11. 2
      spec/models/form/lettings/questions/uprn_spec.rb
  12. 4
      spec/models/form/sales/questions/prevown_spec.rb
  13. 8
      spec/models/form/sales/questions/privacy_notice_spec.rb
  14. 4
      spec/models/form/sales/questions/staircase_owned_spec.rb
  15. 2
      spec/models/form/sales/questions/uprn_spec.rb
  16. 6
      spec/models/location_deactivation_period_spec.rb
  17. 4
      spec/models/notification_spec.rb
  18. 4
      spec/models/scheme_deactivation_period_spec.rb
  19. 46
      spec/models/validations/financial_validations_spec.rb
  20. 4
      spec/models/validations/household_validations_spec.rb
  21. 4
      spec/models/validations/property_validations_spec.rb
  22. 12
      spec/models/validations/sales/financial_validations_spec.rb
  23. 8
      spec/models/validations/sales/household_validations_spec.rb
  24. 20
      spec/models/validations/sales/property_validations_spec.rb
  25. 12
      spec/models/validations/sales/sale_information_validations_spec.rb
  26. 14
      spec/models/validations/sales/setup_validations_spec.rb
  27. 4
      spec/models/validations/setup_validations_spec.rb
  28. 4
      spec/models/validations/shared_validations_spec.rb
  29. 2
      spec/requests/lettings_logs_controller_spec.rb
  30. 2
      spec/requests/sales_logs_controller_spec.rb
  31. 8
      spec/services/bulk_upload/lettings/validator_spec.rb
  32. 72
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  33. 74
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb
  34. 4
      spec/services/bulk_upload/sales/validator_spec.rb
  35. 14
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb
  36. 42
      spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

6
app/controllers/auth/sessions_controller.rb

@ -4,12 +4,12 @@ class Auth::SessionsController < Devise::SessionsController
def create
self.resource = User.new
if params.dig("user", "email").empty?
resource.errors.add :email, "Enter an email address"
resource.errors.add :email, "Enter an email address."
elsif !email_valid?(params.dig("user", "email"))
resource.errors.add :email, "Enter an email address in the correct format, like name@example.com"
resource.errors.add :email, "Enter an email address in the correct format, like name@example.com."
end
if params.dig("user", "password").empty?
resource.errors.add :password, "Enter a password"
resource.errors.add :password, "Enter a password."
end
if resource.errors.present?
render :new, status: :unprocessable_entity

24
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
@ -588,7 +588,7 @@ private
field_mapping_for_errors[interruption_screen_question_id.to_sym]&.each do |field|
if errors.none? { |e| field_mapping_for_errors[interruption_screen_question_id.to_sym].include?(e.attribute) }
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(". ")
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(" ")
errors.add(field, message: error_message, category: :soft_validation)
end
end
@ -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

24
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
@ -650,7 +650,7 @@ private
field_mapping_for_errors[interruption_screen_question_id.to_sym]&.each do |field|
if errors.none? { |e| field_mapping_for_errors[interruption_screen_question_id.to_sym].include?(e.attribute) }
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(". ")
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(" ")
errors.add(field, message: error_message, category: :soft_validation)
end
end
@ -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

20
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
@ -1321,7 +1321,7 @@ private
field_mapping_for_errors[interruption_screen_question_id.to_sym]&.each do |field|
if errors.none? { |e| e.options[:category] == :soft_validation && field_mapping_for_errors[interruption_screen_question_id.to_sym].include?(e.attribute) }
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(". ")
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(" ")
errors.add(field, message: error_message, category: :soft_validation)
end
end
@ -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

18
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
@ -1457,7 +1457,7 @@ private
field_mapping_for_errors[interruption_screen_question_id.to_sym]&.each do |field|
if errors.none? { |e| e.options[:category] == :soft_validation && field_mapping_for_errors[interruption_screen_question_id.to_sym].include?(e.attribute) }
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(". ")
error_message = [display_title_text(question.page.title_text, log), display_informative_text(question.page.informative_text, log)].reject(&:empty?).join(" ")
errors.add(field, message: error_message, category: :soft_validation)
end
end

715
config/locales/en.yml

File diff suppressed because it is too large Load Diff

4
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

2
spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb

@ -445,7 +445,7 @@ RSpec.describe "bulk_update" do
expect(Rails.logger).to receive(:info).with("Will not export log #{lettings_log_5.id} as it is before the exportable date")
expect(Rails.logger).to receive(:info).with("No changes to location #{locations[1].id}.")
expect(Rails.logger).to receive(:info).with("Cannot update location #{locations[2].id} with postcode: SWAAA. Enter a postcode in the correct format, for example AA1 1AA")
expect(Rails.logger).to receive(:info).with("Cannot update location #{locations[2].id} with postcode: SWAAA. Enter a postcode in the correct format, for example AA1 1AA.")
expect(Rails.logger).to receive(:info).with("Cannot update location #{locations[2].id} with scheme_code: S. Scheme with id S is not in the database")
expect(Rails.logger).to receive(:info).with("Cannot update location #{locations[2].id} with location_admin_district: Westminst. Location admin distrint Westminst is not a valid option")
expect(Rails.logger).to receive(:info).with("Cannot update location #{locations[2].id} with type_of_unit: elf-contained house. 'elf-contained house' is not a valid type_of_unit")

4
spec/models/form/lettings/questions/declaration_spec.rb

@ -63,7 +63,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the tenant before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the tenant before you can submit this log.")
end
end
@ -87,7 +87,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show or give the tenant access to the MHCLG privacy notice before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show or give the tenant access to the MHCLG privacy notice before you can submit this log.")
end
end
end

2
spec/models/form/lettings/questions/offered_spec.rb

@ -18,7 +18,7 @@ RSpec.describe Form::Lettings::Questions::Offered, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq "Times previously offered since becoming available"
expect(question.check_answer_label).to eq "Times previously offered since becoming available."
end
it "has the correct type" do

2
spec/models/form/lettings/questions/uprn_spec.rb

@ -40,7 +40,7 @@ RSpec.describe Form::Lettings::Questions::Uprn, type: :model do
end
it "has the correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("UPRN must be 12 digits or less")
expect(question.unanswered_error_message).to eq("UPRN must be 12 digits or less.")
end
describe "get_extra_check_answer_value" do

4
spec/models/form/sales/questions/prevown_spec.rb

@ -22,7 +22,7 @@ RSpec.describe Form::Sales::Questions::Prevown, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer previously owned a property")
expect(question.check_answer_label).to eq("Buyer previously owned a property.")
end
end
@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::Prevown, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyers previously owned a property")
expect(question.check_answer_label).to eq("Buyers previously owned a property.")
end
end

8
spec/models/form/sales/questions/privacy_notice_spec.rb

@ -60,7 +60,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log.")
end
end
@ -78,7 +78,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log.")
end
end
end
@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show or give the buyer access to the MHCLG privacy notice before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show or give the buyer access to the MHCLG privacy notice before you can submit this log.")
end
end
@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show or give the buyers access to the MHCLG privacy notice before you can submit this log")
expect(question.unanswered_error_message).to eq("You must show or give the buyers access to the MHCLG privacy notice before you can submit this log.")
end
end
end

4
spec/models/form/sales/questions/staircase_owned_spec.rb

@ -24,7 +24,7 @@ RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Percentage the buyers now own in total")
expect(question.check_answer_label).to eq("Percentage the buyers now own in total.")
end
end
@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Percentage the buyer now owns in total")
expect(question.check_answer_label).to eq("Percentage the buyer now owns in total.")
end
end

2
spec/models/form/sales/questions/uprn_spec.rb

@ -40,7 +40,7 @@ RSpec.describe Form::Sales::Questions::Uprn, type: :model do
end
it "has the correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("UPRN must be 12 digits or less")
expect(question.unanswered_error_message).to eq("UPRN must be 12 digits or less.")
end
describe "get_extra_check_answer_value" do

6
spec/models/location_deactivation_period_spec.rb

@ -23,7 +23,7 @@ RSpec.describe LocationDeactivationPeriod do
record.deactivation_date = current_collection_start_date - 1.year
location.location_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2023"
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2023."
end
end
@ -47,7 +47,7 @@ RSpec.describe LocationDeactivationPeriod do
record.deactivation_date = previous_collection_start_date - 2.years
location.location_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2022"
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2022."
end
end
@ -80,7 +80,7 @@ RSpec.describe LocationDeactivationPeriod do
location.location_deactivation_periods.clear
validator.validate(record)
start_date = startdate.to_formatted_s(:govuk_date)
expect(record.errors[:deactivation_date]).to include "The location cannot be deactivated before #{start_date}, the date when it was first available"
expect(record.errors[:deactivation_date]).to include "The location cannot be deactivated before #{start_date}, the date when it was first available."
end
end
end

4
spec/models/notification_spec.rb

@ -9,7 +9,7 @@ RSpec.describe Notification, type: :model do
it "adds an error to page_content" do
notification.valid?
expect(notification.errors[:page_content]).to include("Enter the page content")
expect(notification.errors[:page_content]).to include("Enter the page content.")
end
end
@ -19,7 +19,7 @@ RSpec.describe Notification, type: :model do
it "adds an error to link_text" do
notification.valid?
expect(notification.errors[:link_text]).to include("Enter the link text")
expect(notification.errors[:link_text]).to include("Enter the link text.")
end
end
end

4
spec/models/scheme_deactivation_period_spec.rb

@ -23,7 +23,7 @@ RSpec.describe SchemeDeactivationPeriod do
record.deactivation_date = current_collection_start_date - 1.year
scheme.scheme_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include("The date must be on or after the 1 April 2023")
expect(record.errors[:deactivation_date]).to include("The date must be on or after the 1 April 2023.")
end
end
@ -47,7 +47,7 @@ RSpec.describe SchemeDeactivationPeriod do
record.deactivation_date = previous_collection_start_date - 2.years
scheme.scheme_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include("The date must be on or after the 1 April 2022")
expect(record.errors[:deactivation_date]).to include("The date must be on or after the 1 April 2022.")
end
end

46
spec/models/validations/financial_validations_spec.rb

@ -237,9 +237,9 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat1 = 1
financial_validator.validate_net_income(record)
expect(record.errors["earnings"])
.to eq(["The household’s income cannot be greater than £1,230.00 per week given the household’s working situation"])
.to eq(["The household’s income cannot be greater than £1,230.00 per week given the household’s working situation."])
expect(record.errors["ecstat1"])
.to eq(["The household’s income of £5,000.00 weekly is too high given the household’s working situation"])
.to eq(["The household’s income of £5,000.00 weekly is too high given the household’s working situation."])
expect(record.errors["hhmemb"])
.to eq(["The household’s income of £5,000.00 weekly is too high for this number of tenants. Change either the household income or number of tenants."])
end
@ -254,9 +254,9 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat1 = 1
financial_validator.validate_net_income(record)
expect(record.errors["earnings"])
.to eq(["The household’s income cannot be less than £90.00 per week given the household’s working situation"])
.to eq(["The household’s income cannot be less than £90.00 per week given the household’s working situation."])
expect(record.errors["ecstat1"])
.to eq(["The household’s income of £50.00 weekly is too low given the household’s working situation"])
.to eq(["The household’s income of £50.00 weekly is too low given the household’s working situation."])
expect(record.errors["hhmemb"])
.to eq(["The household’s income of £50.00 weekly is too low for this number of tenants. Change either the household income or number of tenants."])
end
@ -286,7 +286,7 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat3 = 9
financial_validator.validate_net_income(record)
expect(record.errors["earnings"])
.to eq(["The household’s income cannot be less than £150.00 per week given the household’s working situation"])
.to eq(["The household’s income cannot be less than £150.00 per week given the household’s working situation."])
end
it "adds errors to relevant fields for each tenant when income is too high" do
@ -301,7 +301,7 @@ RSpec.describe Validations::FinancialValidations do
financial_validator.validate_net_income(record)
(1..record.hhmemb).each do |n|
expect(record.errors["ecstat#{n}"])
.to eq(["The household’s income of £5,000.00 weekly is too high given the household’s working situation"])
.to eq(["The household’s income of £5,000.00 weekly is too high given the household’s working situation."])
end
expect(record.errors["age1"]).to be_empty
expect(record.errors["age2"]).to be_empty
@ -325,7 +325,7 @@ RSpec.describe Validations::FinancialValidations do
financial_validator.validate_net_income(record)
(1..record.hhmemb).each do |n|
expect(record.errors["ecstat#{n}"])
.to eq(["The household’s income of £50.00 weekly is too low given the household’s working situation"])
.to eq(["The household’s income of £50.00 weekly is too low given the household’s working situation."])
end
(record.hhmemb + 1..8).each do |n|
expect(record.errors["ecstat#{n}"]).to be_empty
@ -1121,9 +1121,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 5001
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks")
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks")
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks.")
end
it "validates charge when period is monthly" do
@ -1131,9 +1131,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 21_667
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month")
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month")
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month.")
end
it "validates charge when period is every 2 weeks" do
@ -1141,9 +1141,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 12_001
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks")
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks")
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks.")
end
it "validates charge when period is every 4 weeks" do
@ -1151,9 +1151,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 24_001
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks")
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks")
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks.")
end
end
@ -1209,9 +1209,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 9
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks")
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks")
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks.")
end
it "validates charge when period is monthly" do
@ -1219,9 +1219,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 42
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month")
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month")
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month.")
end
it "validates charge when period is every 2 weeks" do
@ -1229,9 +1229,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 19
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks")
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks")
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks.")
end
it "validates charge when period is every 4 weeks" do
@ -1239,9 +1239,9 @@ RSpec.describe Validations::FinancialValidations do
record.chcharge = 39
financial_validator.validate_care_home_charges(record)
expect(record.errors["chcharge"])
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks")
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks.")
expect(record.errors["period"])
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks")
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks.")
end
end
end

4
spec/models/validations/household_validations_spec.rb

@ -763,7 +763,7 @@ RSpec.describe Validations::HouseholdValidations do
it "is invalid" do
household_validator.validate_combination_of_housing_needs_responses(record)
error_message = ["If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs"]
error_message = ["If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs."]
expect(record.errors["housingneeds"]).to eq(error_message)
expect(record.errors["housingneeds_type"]).to eq(error_message)
@ -779,7 +779,7 @@ RSpec.describe Validations::HouseholdValidations do
it "is invalid" do
household_validator.validate_combination_of_housing_needs_responses(record)
error_message = ["If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs"]
error_message = ["If somebody in the household has disabled access needs, they must have the access needs listed, or other access needs."]
expect(record.errors["housingneeds"]).to eq(error_message)
expect(record.errors["housingneeds_type"]).to eq(error_message)

4
spec/models/validations/property_validations_spec.rb

@ -276,7 +276,7 @@ RSpec.describe Validations::PropertyValidations do
it "adds an error" do
property_validator.validate_uprn(log)
expect(log.errors.added?(:uprn, "UPRN must be 12 digits or less")).to be true
expect(log.errors.added?(:uprn, "UPRN must be 12 digits or less.")).to be true
end
end
@ -285,7 +285,7 @@ RSpec.describe Validations::PropertyValidations do
it "adds an error" do
property_validator.validate_uprn(log)
expect(log.errors.added?(:uprn, "UPRN must be 12 digits or less")).to be true
expect(log.errors.added?(:uprn, "UPRN must be 12 digits or less.")).to be true
end
end

12
spec/models/validations/sales/financial_validations_spec.rb

@ -187,7 +187,7 @@ RSpec.describe Validations::Sales::FinancialValidations do
record.stairowned = 40
record.jointpur = 1
financial_validator.validate_percentage_bought_not_greater_than_percentage_owned(record)
expect(record.errors["stairowned"]).to include("Total percentage buyers now own must be more than percentage bought in this transaction")
expect(record.errors["stairowned"]).to include("Total percentage buyers now own must be more than percentage bought in this transaction.")
end
it "adds an error to stairowned and not stairbought if the percentage bought is more than the percentage owned for non joint purchase" do
@ -195,7 +195,7 @@ RSpec.describe Validations::Sales::FinancialValidations do
record.stairowned = 40
record.jointpur = 2
financial_validator.validate_percentage_bought_not_greater_than_percentage_owned(record)
expect(record.errors["stairowned"]).to include("Total percentage buyer now owns must be more than percentage bought in this transaction")
expect(record.errors["stairowned"]).to include("Total percentage buyer now owns must be more than percentage bought in this transaction.")
end
end
@ -270,8 +270,8 @@ RSpec.describe Validations::Sales::FinancialValidations do
[2, 16, 18, 24].each do |type|
record.type = type
financial_validator.validate_percentage_bought_at_least_threshold(record)
expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 10%"])
expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 10% for this shared ownership type"])
expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 10%."])
expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 10% for this shared ownership type."])
record.errors.clear
end
@ -279,8 +279,8 @@ RSpec.describe Validations::Sales::FinancialValidations do
[28, 30, 31, 32].each do |type|
record.type = type
financial_validator.validate_percentage_bought_at_least_threshold(record)
expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 1%"])
expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 1% for this shared ownership type"])
expect(record.errors["stairbought"]).to eq(["The minimum increase in equity while staircasing is 1%."])
expect(record.errors["type"]).to eq(["The minimum increase in equity while staircasing is 1% for this shared ownership type."])
record.errors.clear
end
end

8
spec/models/validations/sales/household_validations_spec.rb

@ -345,8 +345,8 @@ RSpec.describe Validations::Sales::HouseholdValidations do
[3, 4, 5, 6, 7, 9, 0].each do |prevten|
record.prevten = prevten
household_validator.validate_buyer1_previous_tenure(record)
expect(record.errors["prevten"]).to include("Buyer 1’s previous tenure should be “local authority tenant” or “private registered provider or housing association tenant” for discounted sales")
expect(record.errors["ownershipsch"]).to include("Buyer 1’s previous tenure should be “local authority tenant” or “private registered provider or housing association tenant” for discounted sales")
expect(record.errors["prevten"]).to include("Buyer 1’s previous tenure should be “local authority tenant” or “private registered provider or housing association tenant” for discounted sales.")
expect(record.errors["ownershipsch"]).to include("Buyer 1’s previous tenure should be “local authority tenant” or “private registered provider or housing association tenant” for discounted sales.")
end
end
@ -420,7 +420,7 @@ RSpec.describe Validations::Sales::HouseholdValidations do
record.ecstat1 = 9
household_validator.validate_buyer_not_child(record)
expect(record.errors["ecstat1"])
.to include("Buyer 1 cannot have a working situation of child under 16")
.to include("Buyer 1 cannot have a working situation of child under 16.")
end
it "validates buyer 2 isn't a child" do
@ -428,7 +428,7 @@ RSpec.describe Validations::Sales::HouseholdValidations do
record.ecstat2 = 9
household_validator.validate_buyer_not_child(record)
expect(record.errors["ecstat2"])
.to include("Buyer 2 cannot have a working situation of child under 16")
.to include("Buyer 2 cannot have a working situation of child under 16.")
end
it "allows person 2 to be a child" do

20
spec/models/validations/sales/property_validations_spec.rb

@ -51,9 +51,9 @@ RSpec.describe Validations::Sales::PropertyValidations do
record.ppostcode_full = "SW1A 0AA"
record.jointpur = 1
property_validator.validate_postcodes_match_if_discounted_ownership(record)
expect(record.errors["postcode_full"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match")
expect(record.errors["ppostcode_full"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match")
expect(record.errors["ownershipsch"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match")
expect(record.errors["postcode_full"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match.")
expect(record.errors["ppostcode_full"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match.")
expect(record.errors["ownershipsch"]).to include("Buyers’ last accommodation and discounted ownership postcodes must match.")
end
it "when postcodes do not match an error is added for non joint purchase" do
@ -61,9 +61,9 @@ RSpec.describe Validations::Sales::PropertyValidations do
record.ppostcode_full = "SW1A 0AA"
record.jointpur = 2
property_validator.validate_postcodes_match_if_discounted_ownership(record)
expect(record.errors["postcode_full"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match")
expect(record.errors["ppostcode_full"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match")
expect(record.errors["ownershipsch"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match")
expect(record.errors["postcode_full"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match.")
expect(record.errors["ppostcode_full"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match.")
expect(record.errors["ownershipsch"]).to include("Buyer’s last accommodation and discounted ownership postcodes must match.")
end
it "does not add error for 2024 log" do
@ -93,8 +93,8 @@ RSpec.describe Validations::Sales::PropertyValidations do
it "does add an error if it's a bedsit" do
property_validator.validate_bedsit_number_of_beds(record)
expect(record.errors.added?(:proptype, "Answer cannot be 'Bedsit' if the property has 2 or more bedrooms")).to be true
expect(record.errors.added?(:beds, "Number of bedrooms must be 1 if the property is a bedsit")).to be true
expect(record.errors.added?(:proptype, "Answer cannot be 'Bedsit' if the property has 2 or more bedrooms.")).to be true
expect(record.errors.added?(:beds, "Number of bedrooms must be 1 if the property is a bedsit.")).to be true
end
it "does not add an error if proptype is undefined" do
@ -120,7 +120,7 @@ RSpec.describe Validations::Sales::PropertyValidations do
it "adds an error" do
property_validator.validate_uprn(record)
expect(record.errors.added?(:uprn, "UPRN must be 12 digits or less")).to be true
expect(record.errors.added?(:uprn, "UPRN must be 12 digits or less.")).to be true
end
end
@ -129,7 +129,7 @@ RSpec.describe Validations::Sales::PropertyValidations do
it "adds an error" do
property_validator.validate_uprn(record)
expect(record.errors.added?(:uprn, "UPRN must be 12 digits or less")).to be true
expect(record.errors.added?(:uprn, "UPRN must be 12 digits or less.")).to be true
end
end

12
spec/models/validations/sales/sale_information_validations_spec.rb

@ -147,10 +147,10 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
sale_information_validator.validate_exchange_date(record)
expect(record.errors[:exdate]).to eq(
["Contract exchange date must be less than 1 year before sale completion date"],
["Contract exchange date must be less than 1 year before sale completion date."],
)
expect(record.errors[:saledate]).to eq(
["Sale completion date must be less than 1 year after contract exchange date"],
["Sale completion date must be less than 1 year after contract exchange date."],
)
end
end
@ -162,10 +162,10 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
sale_information_validator.validate_exchange_date(record)
expect(record.errors[:exdate]).to eq(
["Contract exchange date must be before sale completion date"],
["Contract exchange date must be before sale completion date."],
)
expect(record.errors[:saledate]).to eq(
["Sale completion date must be after contract exchange date"],
["Sale completion date must be after contract exchange date."],
)
end
end
@ -671,7 +671,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_grant_amount(record)
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000")
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000.")
end
end
@ -681,7 +681,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_grant_amount(record)
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000")
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000.")
end
end

14
spec/models/validations/sales/setup_validations_spec.rb

@ -91,7 +91,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do
setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.")
end
end
@ -105,7 +105,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do
setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.")
end
end
@ -119,7 +119,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "cannot create new logs for the archived collection year" do
record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.")
end
it "can edit already created logs for the previous collection year" do
@ -127,7 +127,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.save!(validate: false)
record.saledate = Time.zone.local(2024, 1, 1)
setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).not_to include(match "Enter a date within the 24/25 collection year, which is between 1st April 2024 and 31st March 2025")
expect(record.errors["saledate"]).not_to include(match "Enter a date within the 24/25 collection year, which is between 1st April 2024 and 31st March 2025.")
end
end
@ -142,7 +142,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.update!(saledate: nil)
record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.")
end
it "cannot edit already created logs for the archived collection year" do
@ -150,7 +150,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.save!(validate: false)
record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.")
end
end
end
@ -183,7 +183,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds an error" do
setup_validator.validate_saledate_two_weeks(record)
expect(record.errors[:saledate]).to include("Sale completion date must not be later than 14 days from today’s date")
expect(record.errors[:saledate]).to include("Sale completion date must not be later than 14 days from today’s date.")
end
end
end

4
spec/models/validations/setup_validations_spec.rb

@ -157,7 +157,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2024, 4, 1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"].length).to be >= 2
expect(record.errors["startdate"][0]).to eq("Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
expect(record.errors["startdate"][0]).to eq("Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024.")
expect(record.errors["startdate"][1]).to eq(I18n.t("validations.setup.startdate.later_than_14_days_after"))
end
end
@ -700,7 +700,7 @@ RSpec.describe Validations::SetupValidations do
record.location = location
setup_validator.validate_location(record)
expect(record.errors["location_id"])
.to include("This location is incomplete. Select another location or update this one")
.to include("This location is incomplete. Select another location or update this one.")
end
it "produces no error when location is completes" do

4
spec/models/validations/shared_validations_spec.rb

@ -75,14 +75,14 @@ RSpec.describe Validations::SharedValidations do
sales_log.details_known_2 = 1
sales_log.age2 = 130
shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["age2"].first).to eq("Person 2’s age must be between 0 and 110")
expect(sales_log.errors["age2"].first).to eq("Person 2’s age must be between 0 and 110.")
end
it "validates that buyer 2's age is between 0 and 110 for joint purchase" do
sales_log.jointpur = 1
sales_log.age2 = 130
shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 16 and 110")
expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 16 and 110.")
end
end
end

2
spec/requests/lettings_logs_controller_spec.rb

@ -1570,7 +1570,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "returns an error message" do
json_response = JSON.parse(response.body)
expect(json_response["errors"]).to eq({ "age1" => ["Lead tenant’s age must be between 16 and 120"] })
expect(json_response["errors"]).to eq({ "age1" => ["Lead tenant’s age must be between 16 and 120."] })
end
end

2
spec/requests/sales_logs_controller_spec.rb

@ -93,7 +93,7 @@ RSpec.describe SalesLogsController, type: :request do
it "validates sales log parameters" do
json_response = JSON.parse(response.body)
expect(response).to have_http_status(:unprocessable_entity)
expect(json_response["errors"]).to match_array([["beds", ["Number of bedrooms must be 1 if the property is a bedsit"]], ["proptype", ["Answer cannot be 'Bedsit' if the property has 2 or more bedrooms"]]])
expect(json_response["errors"]).to match_array([["beds", ["Number of bedrooms must be 1 if the property is a bedsit."]], ["proptype", ["Answer cannot be 'Bedsit' if the property has 2 or more bedrooms."]]])
end
end
end

8
spec/services/bulk_upload/lettings/validator_spec.rb

@ -51,7 +51,7 @@ RSpec.describe BulkUpload::Lettings::Validator do
it "is not valid" do
expect(validator).not_to be_valid
expect(validator.errors["base"]).to eql(["Incorrect number of fields, please ensure you have used the correct template"])
expect(validator.errors["base"]).to eql(["Incorrect number of fields, please ensure you have used the correct template."])
end
end
@ -68,7 +68,7 @@ RSpec.describe BulkUpload::Lettings::Validator do
it "is not valid" do
expect(validator).not_to be_valid
expect(validator.errors["base"]).to eql(["Incorrect number of fields, please ensure you have used the correct template"])
expect(validator.errors["base"]).to eql(["Incorrect number of fields, please ensure you have used the correct template."])
end
end
end
@ -90,7 +90,7 @@ RSpec.describe BulkUpload::Lettings::Validator do
it "is not valid" do
expect(validator).not_to be_valid
expect(validator.errors["base"]).to eql(["Incorrect start dates, please ensure you have used the correct template"])
expect(validator.errors["base"]).to eql(["Incorrect start dates, please ensure you have used the correct template."])
end
end
end
@ -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

72
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
@ -686,7 +686,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "cannot be nulled" do
parser.valid?
expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log"])
expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log."])
end
end
end
@ -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
@ -1106,8 +1106,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_15]).to be_blank
expect(parser.errors.where(:field_16).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"])
expect(parser.errors.where(:field_17).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"])
expect(parser.errors.where(:field_16).map(&:message)).to eq(["This location is incomplete. Select another location or update this one."])
expect(parser.errors.where(:field_17).map(&:message)).to eq(["This location is incomplete. Select another location or update this one."])
end
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
@ -1480,7 +1480,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "returns an error" do
parser.valid?
expect(parser.errors[:field_9]).to include("Tenancy start year must be 2 digits")
expect(parser.errors[:field_9]).to include("Tenancy start year must be 2 digits.")
end
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
@ -2710,8 +2710,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "sets error on housingneeds a and b" do
parser.valid?
expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_85]).to be_blank
end
end
@ -2721,8 +2721,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "sets error on housingneeds a and c" do
parser.valid?
expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_83]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_84]).to be_blank
end
end
@ -2732,8 +2732,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "sets error on housingneeds b and c" do
parser.valid?
expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_84]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_85]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_83]).to be_blank
end
end
@ -2743,8 +2743,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "sets error on housingneeds a and g" do
parser.valid?
expect(parser.errors[:field_87]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_87]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_84]).to be_blank
expect(parser.errors[:field_85]).to be_blank
end
@ -2767,8 +2767,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "sets error on housingneeds a and h" do
parser.valid?
expect(parser.errors[:field_88]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_83]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_88]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_83]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_84]).to be_blank
expect(parser.errors[:field_85]).to be_blank
end

74
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
@ -747,7 +747,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "cannot be nulled" do
parser.valid?
expect(parser.errors[:field_15]).to eq(["You must show or give the tenant access to the MHCLG privacy notice before you can submit this log"])
expect(parser.errors[:field_15]).to eq(["You must show or give the tenant access to the MHCLG privacy notice before you can submit this log."])
end
end
@ -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
@ -1021,8 +1021,8 @@ 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: "S#{scheme.id}", field_6: incomplete_location.id } }
it "returns a setup error for scheme" do
expect(parser.errors.where(:field_5).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"])
expect(parser.errors.where(:field_6).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"])
expect(parser.errors.where(:field_5).map(&:message)).to eq(["This location is incomplete. Select another location or update this one."])
expect(parser.errors.where(:field_6).map(&:message)).to eq(["This location is incomplete. Select another location or update this one."])
end
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
@ -1297,7 +1297,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "returns an error" do
parser.valid?
expect(parser.errors[:field_10]).to include("Tenancy start year must be 2 digits")
expect(parser.errors[:field_10]).to include("Tenancy start year must be 2 digits.")
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
@ -1602,7 +1602,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an appropriate error to the UPRN field" do
parser.valid?
expect(parser.errors[:field_16]).to eql(["UPRN must be 12 digits or less"])
expect(parser.errors[:field_16]).to eql(["UPRN must be 12 digits or less."])
end
it "adds errors to missing key address fields" do
@ -1619,7 +1619,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error to the UPRN field only" do
parser.valid?
expect(parser.errors[:field_16]).to eql(["UPRN must be 12 digits or less"])
expect(parser.errors[:field_16]).to eql(["UPRN must be 12 digits or less."])
%i[field_17 field_19 field_21 field_22].each do |field|
expect(parser.errors[field]).to be_empty
end
@ -1844,7 +1844,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error to field_45" do
parser.valid?
expect(parser.errors["field_45"]).to include("Select a valid nationality")
expect(parser.errors["field_45"]).to include("Select a valid nationality.")
end
end
end
@ -2813,8 +2813,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "sets error on housingneeds a and b" do
parser.valid?
expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_81]).to be_blank
end
end
@ -2824,8 +2824,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "sets error on housingneeds a and c" do
parser.valid?
expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_79]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_80]).to be_blank
end
end
@ -2835,8 +2835,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "sets error on housingneeds b and c" do
parser.valid?
expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected")
expect(parser.errors[:field_80]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_81]).to include("Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected.")
expect(parser.errors[:field_79]).to be_blank
end
end
@ -2846,8 +2846,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "sets error on housingneeds a and g" do
parser.valid?
expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_79]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_83]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_79]).to include("No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_80]).to be_blank
expect(parser.errors[:field_81]).to be_blank
end
@ -2870,8 +2870,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "sets error on housingneeds a and h" do
parser.valid?
expect(parser.errors[:field_84]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_79]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs")
expect(parser.errors[:field_84]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_79]).to include("Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs.")
expect(parser.errors[:field_80]).to be_blank
expect(parser.errors[:field_81]).to be_blank
end

4
spec/services/bulk_upload/sales/validator_spec.rb

@ -54,7 +54,7 @@ RSpec.describe BulkUpload::Sales::Validator do
it "is not valid" do
expect(validator).not_to be_valid
expect(validator.errors["base"]).to eql(["Incorrect sale dates, please ensure you have used the correct template"])
expect(validator.errors["base"]).to eql(["Incorrect sale dates, please ensure you have used the correct template."])
end
end
@ -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

14
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
@ -597,7 +597,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
let(:attributes) { setup_section_params.merge({ bulk_upload:, field_5: "2022" }) }
it "returns a setup error" do
expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to include("Sale completion year must be 2 digits")
expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to include("Sale completion year must be 2 digits.")
end
end
@ -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

42
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
@ -716,7 +716,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "returns a setup error" do
parser.valid?
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Sale completion year must be 2 digits")
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Sale completion year must be 2 digits.")
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
@ -986,7 +986,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "adds an appropriate error to the UPRN field" do
parser.valid?
expect(parser.errors[:field_22]).to eql(["UPRN must be 12 digits or less"])
expect(parser.errors[:field_22]).to eql(["UPRN must be 12 digits or less."])
end
it "adds errors to missing key address fields" do
@ -1003,7 +1003,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "adds an error to the UPRN field only" do
parser.valid?
expect(parser.errors[:field_22]).to eql(["UPRN must be 12 digits or less"])
expect(parser.errors[:field_22]).to eql(["UPRN must be 12 digits or less."])
%i[field_23 field_25 field_27 field_28].each do |field|
expect(parser.errors[field]).to be_empty
end
@ -1108,7 +1108,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
context "when the privacy notice is not accepted" do
it "cannot be nulled" do
expect(parser.errors[:field_18]).to eq(["You must show or give the buyer access to the MHCLG privacy notice before you can submit this log"])
expect(parser.errors[:field_18]).to eq(["You must show or give the buyer access to the MHCLG privacy notice before you can submit this log."])
end
end
end
@ -1198,7 +1198,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "a custom validation is applied" do
parser.valid?
validation_message = "Buyer 2 cannot have a working situation of child under 16"
validation_message = "Buyer 2 cannot have a working situation of child under 16."
expect(parser.errors[:field_42]).to include validation_message
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
@ -1220,7 +1220,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "a custom validation is applied" do
parser.valid?
validation_message = "Buyer 2's age cannot be 16 or over if their working situation is child under 16"
validation_message = "Buyer 2's age cannot be 16 or over if their working situation is child under 16."
expect(parser.errors[:field_42]).to include validation_message
expect(parser.errors[:field_38]).to include validation_message
end
@ -1244,7 +1244,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "a custom validation is applied" do
parser.valid?
validation_message = "Buyer 1 cannot have a working situation of child under 16"
validation_message = "Buyer 1 cannot have a working situation of child under 16."
expect(parser.errors[:field_35]).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
@ -1266,7 +1266,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "a custom validation is applied" do
parser.valid?
validation_message = "Buyer 1's age cannot be 16 or over if their working situation is child under 16"
validation_message = "Buyer 1's age cannot be 16 or over if their working situation is child under 16."
expect(parser.errors[:field_35]).to include validation_message
expect(parser.errors[:field_31]).to include validation_message
end
@ -1676,7 +1676,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
parser.valid?
expect(parser.log.nationality_all).to be(nil)
expect(parser.log.nationality_all_group).to be(nil)
expect(parser.errors["field_34"]).to include("Select a valid nationality")
expect(parser.errors["field_34"]).to include("Select a valid nationality.")
end
end
end
@ -1761,7 +1761,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
parser.valid?
expect(parser.log.nationality_all_buyer2).to be(nil)
expect(parser.log.nationality_all_buyer2_group).to be(nil)
expect(parser.errors["field_41"]).to include("Select a valid nationality")
expect(parser.errors["field_41"]).to include("Select a valid nationality.")
end
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

Loading…
Cancel
Save