Browse Source

fixes

pull/387/head
Dushan Despotovic 3 years ago
parent
commit
6d7d5a7a33
  1. 2
      app/models/validations/household_validations.rb
  2. 2
      spec/factories/case_log.rb
  3. 2
      spec/fixtures/complete_case_log.json
  4. 2
      spec/fixtures/exports/case_logs.xml
  5. 22
      spec/models/validations/household_validations_spec.rb

2
app/models/validations/household_validations.rb

@ -69,7 +69,7 @@ module Validations::HouseholdValidations
all_options = [record.illness_type_1, record.illness_type_2, record.illness_type_3, record.illness_type_4, record.illness_type_5, record.illness_type_6, record.illness_type_7, record.illness_type_8, record.illness_type_9, record.illness_type_10]
if all_options.count(1) >= 1 && record.illness != 0
record.errors.add :condition_effects, I18n.t("validations.household.condition_effects.no_choices")
end
end
end
def validate_previous_housing_situation(record)

2
spec/factories/case_log.rb

@ -51,7 +51,7 @@ FactoryBot.define do
underoccupation_benefitcap { 0 }
leftreg { 1 }
reservist { 0 }
illness { 1 }
illness { 0 }
preg_occ { 1 }
tenancy_code { "BZ757" }
startertenancy { 0 }

2
spec/fixtures/complete_case_log.json vendored

@ -44,7 +44,7 @@
"underoccupation_benefitcap": 0,
"leftreg": 1,
"reservist": 0,
"illness": 1,
"illness": 0,
"preg_occ": 0,
"tenancy_code": "BZ757",
"startdate": "12/12/2021",

2
spec/fixtures/exports/case_logs.xml vendored

@ -38,7 +38,7 @@
<underoccupation_benefitcap>0</underoccupation_benefitcap>
<leftreg>1</leftreg>
<reservist>0</reservist>
<illness>1</illness>
<illness>0</illness>
<preg_occ>1</preg_occ>
<tenancy_code>BZ757</tenancy_code>
<startertenancy>0</startertenancy>

22
spec/models/validations/household_validations_spec.rb

@ -489,7 +489,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
it "validates hearing can't be selected if answer to anyone in household with health condition is not yes" do
record.illness = 1
@ -497,7 +497,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
it "validates mobility can't be selected if answer to anyone in household with health condition is not yes" do
record.illness = 1
@ -505,7 +505,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
it "validates dexterity can't be selected if answer to anyone in household with health condition is not yes" do
record.illness = 1
@ -513,7 +513,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
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
@ -521,7 +521,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
it "validates memory can't be selected if answer to anyone in household with health condition is not yes" do
record.illness = 1
@ -529,7 +529,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
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
@ -537,15 +537,15 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
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_type_8 = 1
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
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
@ -553,7 +553,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
it "validates other can't be selected if answer to anyone in household with health condition is not yes" do
record.illness = 1
@ -561,7 +561,7 @@ RSpec.describe Validations::HouseholdValidations do
household_validator.validate_condition_effects(record)
expect(record.errors["condition_effects"])
.to include(match I18n.t("validations.household.condition_effects.no_choices"))
end
end
end
describe "accessibility requirement validations" do

Loading…
Cancel
Save