|
|
|
|
@ -252,18 +252,18 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
record.hhmemb = 0 |
|
|
|
|
household_validator.validate_numeric_min_max(record) |
|
|
|
|
expect(record.errors["hhmemb"]) |
|
|
|
|
.to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 8)) |
|
|
|
|
.to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 15)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates that the number of household members cannot be more than 8" do |
|
|
|
|
record.hhmemb = 9 |
|
|
|
|
it "validates that the number of household members cannot be more than 15" do |
|
|
|
|
record.hhmemb = 16 |
|
|
|
|
household_validator.validate_numeric_min_max(record) |
|
|
|
|
expect(record.errors["hhmemb"]) |
|
|
|
|
.to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 8)) |
|
|
|
|
.to include(match I18n.t("validations.shared.numeric.within_range", field: "Number of household members", min: 1, max: 15)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "expects that the number of other household members is between the min and max" do |
|
|
|
|
record.hhmemb = 5 |
|
|
|
|
it "expects that the number of household members is between the min and max" do |
|
|
|
|
record.hhmemb = 11 |
|
|
|
|
household_validator.validate_numeric_min_max(record) |
|
|
|
|
expect(record.errors["hhmemb"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|