expect(sales_log.errors["savings"]).toinclude(matchI18n.t("validations.numeric.above_min",field:"Buyer’s total savings before any deposit paid",min:"£0"))
expect(sales_log.errors["savings"]).toinclude(matchI18n.t("validations.numeric.above_min",field:"Buyers’ total savings before any deposit paid",min:"£0"))
end
end
context"when validating percent"do
context"when validating percent"do
@ -138,14 +139,16 @@ RSpec.describe Validations::SharedValidations do
context"when validating a question with a step of 10"do
context"when validating a question with a step of 10"do
it"adds an error if input is not a multiple of ten"do
it"adds an error if input is not a multiple of ten"do
sales_log.savings=30_005
sales_log.savings=30_005
sales_log.jointpur=1
shared_validator.validate_numeric_step(sales_log)
shared_validator.validate_numeric_step(sales_log)
expect(sales_log.errors[:savings]).toincludeI18n.t("validations.numeric.nearest_ten",field:"Buyer’s total savings before any deposit paid")
expect(sales_log.errors[:savings]).toincludeI18n.t("validations.numeric.nearest_ten",field:"Buyers’ total savings before any deposit paid")
end
end
it"adds an error if the user attempts to input a number in exponent format"do
it"adds an error if the user attempts to input a number in exponent format"do
sales_log.savings="3e5"
sales_log.savings="3e5"
sales_log.jointpur=1
shared_validator.validate_numeric_step(sales_log)
shared_validator.validate_numeric_step(sales_log)
expect(sales_log.errors[:savings]).toincludeI18n.t("validations.numeric.nearest_ten",field:"Buyer’s total savings before any deposit paid")
expect(sales_log.errors[:savings]).toincludeI18n.t("validations.numeric.nearest_ten",field:"Buyers’ total savings before any deposit paid")
end
end
it"does not add an error if input is a multiple of ten"do
it"does not add an error if input is a multiple of ten"do