|
|
|
|
@ -512,7 +512,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
|
|
|
|
|
describe "condition effects validation" do |
|
|
|
|
it "validates vision can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_1 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -520,7 +520,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates hearing can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_2 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -528,7 +528,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates mobility can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_3 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -536,7 +536,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates dexterity can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_4 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -544,7 +544,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates learning or understanding or concentrating can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_5 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -552,7 +552,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates memory can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_6 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -560,7 +560,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates mental health can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_7 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -568,7 +568,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates stamina or breathing or fatigue can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_8 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -576,7 +576,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates socially or behaviourally can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_9 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -584,7 +584,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates other can't be selected if answer to anyone in household with health condition is not yes" do |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness = 2 |
|
|
|
|
record.illness_type_10 = 1 |
|
|
|
|
household_validator.validate_condition_effects(record) |
|
|
|
|
expect(record.errors["condition_effects"]) |
|
|
|
|
@ -592,7 +592,7 @@ RSpec.describe Validations::HouseholdValidations do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "expects that an illness can be selected if answer to anyone in household with health condition is yes " do |
|
|
|
|
record.illness = 0 |
|
|
|
|
record.illness = 1 |
|
|
|
|
record.illness_type_1 = 1 |
|
|
|
|
record.illness_type_2 = 1 |
|
|
|
|
record.illness_type_3 = 1 |
|
|
|
|
|