Browse Source

fix specs

pull/311/head
MadeTech Dushan 3 years ago
parent
commit
72a515e9da
  1. 2
      spec/factories/case_log.rb
  2. 4
      spec/features/form/conditional_questions_spec.rb
  3. 2
      spec/fixtures/complete_case_log.json
  4. 16
      spec/fixtures/forms/2021_2022.json
  5. 6
      spec/models/validations/household_validations_spec.rb

2
spec/factories/case_log.rb

@ -49,7 +49,7 @@ FactoryBot.define do
ecstat2 { "Not seeking work" }
homeless { "Other homeless - not found statutorily homeless but considered homeless by landlord" }
underoccupation_benefitcap { "No" }
leftreg { "No - they left up to 5 years ago" }
leftreg { "No, they left up to and including 5 years ago" }
reservist { "No" }
illness { "Yes" }
preg_occ { "Yes" }

4
spec/features/form/conditional_questions_spec.rb

@ -27,11 +27,11 @@ RSpec.describe "Form Conditional Questions" do
it "shows conditional questions if the required answer is selected and hides it again when a different answer option is selected", js: true do
visit("/logs/#{id}/armed-forces")
# Something about our styling makes the selenium webdriver think the actual radio buttons are not visible so we allow label click here
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-excluding-national-service-field", allow_label_click: true)
choose("case-log-armedforces-yes-the-tenant-is-a-current-or-former-regular-field", allow_label_click: true)
fill_in("case-log-leftreg-field", with: "text")
choose("case-log-armedforces-no-field", allow_label_click: true)
expect(page).not_to have_field("case-log-leftreg-field")
choose("case-log-armedforces-a-current-or-former-regular-in-the-uk-armed-forces-excluding-national-service-field", allow_label_click: true)
choose("case-log-armedforces-yes-the-tenant-is-a-current-or-former-regular-field", allow_label_click: true)
expect(page).to have_field("case-log-leftreg-field", with: "")
end
end

2
spec/fixtures/complete_case_log.json vendored

@ -43,7 +43,7 @@
"homeless": "No",
"reason": 1,
"underoccupation_benefitcap": "No",
"leftreg": "No - they left up to 5 years ago",
"leftreg": "No, they left up to and including 5 years ago",
"reservist": "No",
"illness": "Yes",
"preg_occ": "No",

16
spec/fixtures/forms/2021_2022.json vendored

@ -156,25 +156,25 @@
"header": "Experience of the UK Armed Forces",
"questions": {
"armedforces": {
"header": "Is anyone in the household...",
"hint_text": "This excludes national service",
"header": "Does anybody in the household have any links to the UK armed forces?",
"hint_text": "This excludes national service. If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner.",
"type": "radio",
"check_answer_label": "Armed Forces",
"check_answer_label": "Household links to UK armed forces",
"answer_options": {
"0":{
"value": "A current or former regular in the UK Armed Forces (excluding National Service)"
"0": {
"value": "Yes, the tenant is a current or former regular"
},
"1": {
"value": "A current or former reserve in the UK Armed Forces (excluding National Service)"
"value": "Yes, the tenant is a current or former reserve"
},
"2": {
"value": "A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years"
"value": "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years"
},
"3": {
"value": "No"
},
"4": {
"value": "Tenant prefers not to say"
"value": "Person prefers not to say"
}
},
"conditional_for": {

6
spec/models/validations/household_validations_spec.rb

@ -244,7 +244,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant prefers not to say if they were or are in the armed forces" do
it "validates that injured in the armed forces is not yes" do
record.armedforces = "Tenant prefers not to say"
record.armedforces = "Person prefers not to say"
record.reservist = "Yes"
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"])
@ -263,7 +263,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant was or is a reserve member of the armed forces" do
it "expects that injured in the armed forces can be yes" do
record.armedforces = "A current or former reserve in the UK Armed Forces (excluding National Service)"
record.armedforces = "Yes, the tenant is a current or former reserve"
record.reservist = "Yes"
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"]).to be_empty
@ -272,7 +272,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant's partner was or is a member of the armed forces" do
it "expects that injured in the armed forces can be yes" do
record.armedforces = "A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years"
record.armedforces = "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years"
record.reservist = "Yes"
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"]).to be_empty

Loading…
Cancel
Save