diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index 6a42b02f5..bc84dd174 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -44,7 +44,7 @@ module Validations::SharedValidations incorrect_accuracy = (value.to_d * 100) % (question.step * 100) != 0 if question.step < 1 && incorrect_accuracy - record.errors.add question.id.to_sym, I18n.t("validations.numeric.nearest_penny", field:) + record.errors.add question.id.to_sym, I18n.t("validations.numeric.nearest_hundredth", field:) elsif incorrect_accuracy || value.to_d != value.to_i # if the user enters a value in exponent notation (eg '4e1') the to_i method does not convert this to the correct value field = question.check_answer_label || question.id case question.step diff --git a/config/locales/en.yml b/config/locales/en.yml index 616a585f1..a2beaf6cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -141,7 +141,7 @@ en: above_min: "%{field} must be at least %{min}" whole_number: "%{field} must be a whole number" nearest_ten: "%{field} must be given to the nearest ten" - nearest_penny: "%{field} must be given to the nearest penny" + nearest_hundredth: "%{field} must be given to the nearest hundredth" normal_format: "Enter a number" date: diff --git a/spec/models/validations/shared_validations_spec.rb b/spec/models/validations/shared_validations_spec.rb index b2b57f071..88c73934a 100644 --- a/spec/models/validations/shared_validations_spec.rb +++ b/spec/models/validations/shared_validations_spec.rb @@ -159,7 +159,7 @@ RSpec.describe Validations::SharedValidations do it "adds an error if input has more than 2 decimal places" do sales_log.mscharge = 30.7418 shared_validator.validate_numeric_step(sales_log) - expect(sales_log.errors[:mscharge]).to include I18n.t("validations.numeric.nearest_penny", field: "Monthly leasehold charges") + expect(sales_log.errors[:mscharge]).to include I18n.t("validations.numeric.nearest_hundredth", field: "Monthly leasehold charges") end it "does not add an error if the user attempts to input a number in exponent format" do