Browse Source

Update error messages

pull/2629/head
Manny Dinssa 2 years ago
parent
commit
0e6ec911fe
  1. 4
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 4
      app/services/bulk_upload/sales/year2024/row_parser.rb
  3. 4
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb
  4. 4
      spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

4
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -584,7 +584,7 @@ private
def validate_assigned_to_when_support
if field_3.blank? && bulk_upload.user.support?
block_log_creation!
errors.add(:field_3, :setup, message: "User was not provided")
errors.add(:field_3, :setup, message: I18n.t("validations.not_answered", question: "what is the CORE username of the account this letting log should be assigned to?"))
end
end
@ -905,7 +905,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

4
app/services/bulk_upload/sales/year2024/row_parser.rb

@ -1309,7 +1309,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
@ -1324,7 +1324,7 @@ private
def validate_assigned_to_when_support
if field_3.blank? && bulk_upload.user.support?
block_log_creation!
errors.add(:field_3, :setup, message: "User was not provided")
errors.add(:field_3, :setup, message: I18n.t("validations.not_answered", question: "what is the CORE username of the account this sales log should be assigned to?"))
end
end

4
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -1454,7 +1454,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
@ -1471,7 +1471,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

4
spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

@ -569,7 +569,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
@ -586,7 +586,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

Loading…
Cancel
Save