@ -180,7 +180,7 @@ RSpec.describe Validations::SoftValidations do
end
end
end
end
context " when all tenants are male and household members are over 8 " do
context " when all tenants are male and more than 8 household members " do
it " does not show the interruption screen " do
it " does not show the interruption screen " do
( 1 .. 8 ) . each do | n |
( 1 .. 8 ) . each do | n |
record . send ( " sex #{ n } = " , " M " )
record . send ( " sex #{ n } = " , " M " )
@ -196,7 +196,7 @@ RSpec.describe Validations::SoftValidations do
context " when female tenants are under 16 " do
context " when female tenants are under 16 " do
it " shows the interruption screen " do
it " shows the interruption screen " do
record . age2 = 14
record . age2 = 15
record . sex2 = " F "
record . sex2 = " F "
record . preg_occ = 1
record . preg_occ = 1
record . hhmemb = 2
record . hhmemb = 2
@ -209,9 +209,20 @@ RSpec.describe Validations::SoftValidations do
end
end
end
end
context " when female tenants are 16 and over " do
it " does not show the interruption screen " do
record . age1 = 16
record . sex1 = " F "
record . preg_occ = 1
record . hhmemb = 1
record . age1_known = 0
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range? ) . to be false
end
end
context " when female tenants are over 50 " do
context " when female tenants are over 50 " do
it " shows the interruption screen " do
it " shows the interruption screen " do
record . age1 = 54
record . age1 = 51
record . sex1 = " F "
record . sex1 = " F "
record . preg_occ = 1
record . preg_occ = 1
record . hhmemb = 1
record . hhmemb = 1
@ -220,9 +231,20 @@ RSpec.describe Validations::SoftValidations do
end
end
end
end
context " when female tenants are 50 or under " do
it " shows the interruption screen " do
record . age1 = 50
record . sex1 = " F "
record . preg_occ = 1
record . hhmemb = 1
record . age1_known = 0
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range? ) . to be false
end
end
context " when non-binary tenants are under 16 " do
context " when non-binary tenants are under 16 " do
it " does not show the interruption screen " do
it " does not show the interruption screen " do
record . age2 = 14
record . age2 = 15
record . sex2 = " X "
record . sex2 = " X "
record . preg_occ = 1
record . preg_occ = 1
record . hhmemb = 2
record . hhmemb = 2
@ -237,7 +259,7 @@ RSpec.describe Validations::SoftValidations do
context " when non-binary tenants are over 50 " do
context " when non-binary tenants are over 50 " do
it " does not show the interruption screen " do
it " does not show the interruption screen " do
record . age1 = 54
record . age1 = 51
record . sex1 = " X "
record . sex1 = " X "
record . preg_occ = 1
record . preg_occ = 1
record . hhmemb = 1
record . hhmemb = 1
@ -298,7 +320,7 @@ RSpec.describe Validations::SoftValidations do
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . all_male_tenants_in_a_pregnant_household ?) . to be true
expect ( record . no_household_member_likely_to_be_pregnant ?) . to be true
end
end
end
end
@ -310,11 +332,11 @@ RSpec.describe Validations::SoftValidations do
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . all_male_tenants_in_a_pregnant_household ?) . to be true
expect ( record . no_household_member_likely_to_be_pregnant ?) . to be true
end
end
end
end
context " when all tenants are male and household members are over 8 " do
context " when all tenants are male and more than 8 household members " do
before do
before do
( 1 .. 8 ) . each do | n |
( 1 .. 8 ) . each do | n |
record . send ( " sexrab #{ n } = " , " M " )
record . send ( " sexrab #{ n } = " , " M " )
@ -328,11 +350,23 @@ RSpec.describe Validations::SoftValidations do
end
end
it " does not show the interruption screen " do
it " does not show the interruption screen " do
expect ( record . all_male_tenants_in_a_pregnant_household ?) . to be false
expect ( record . no_household_member_likely_to_be_pregnant ?) . to be false
end
end
end
end
context " when female tenants are under 16 " do
context " when female tenants are 13 or over " do
before do
record . age1 = 13
record . sexrab1 = " F "
record . gender_same_as_sex1 = 1
end
it " does not show the interruption screen " do
expect ( record . no_household_member_likely_to_be_pregnant? ) . to be false
end
end
context " when female tenants are under 13 " do
before do
before do
record . age1 = 12
record . age1 = 12
record . sexrab1 = " F "
record . sexrab1 = " F "
@ -340,23 +374,48 @@ RSpec.describe Validations::SoftValidations do
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range ? ) . to be true
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be true
end
end
end
end
context " when female tenants are over 50 " do
context " when female tenants are 55 or under " do
before do
record . age1 = 55
record . sexrab1 = " F "
record . gender_same_as_sex1 = 1
end
it " does not show the interruption screen " do
expect ( record . no_household_member_likely_to_be_pregnant? ) . to be false
end
end
context " when female tenants are over 55 " do
before do
before do
record . age1 = 60
record . age1 = 5 6
record . sexrab1 = " F "
record . sexrab1 = " F "
record . gender_same_as_sex1 = 1
record . gender_same_as_sex1 = 1
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range? ) . to be true
expect ( record . no_household_member_likely_to_be_pregnant? ) . to be true
end
end
context " when non binary tenants are 13 or over " do
before do
record . age1 = 13
record . sexrab1 = " M "
record . gender_same_as_sex1 = 2
record . gender_description1 = " Non-binary "
end
it " does not show the interruption screen " do
expect ( record . no_household_member_likely_to_be_pregnant? ) . to be false
end
end
end
end
context " when non binary tenants are under 16 " do
context " when non binary tenants are under 13 " do
before do
before do
record . age1 = 12
record . age1 = 12
record . sexrab1 = " M "
record . sexrab1 = " M "
@ -365,20 +424,33 @@ RSpec.describe Validations::SoftValidations do
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range ? ) . to be true
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be true
end
end
end
end
context " when non binary tenants are over 50 " do
context " when non binary tenants are 55 or under " do
before do
before do
record . age1 = 60
record . age1 = 55
record . sexrab1 = " M "
record . gender_same_as_sex1 = 2
record . gender_description1 = " Non-binary "
end
it " does not show the interruption screen " do
expect ( record . no_household_member_likely_to_be_pregnant? ) . to be false
end
end
context " when non binary tenants are over 55 " do
before do
record . age1 = 56
record . sexrab1 = " M "
record . sexrab1 = " M "
record . gender_same_as_sex1 = 2
record . gender_same_as_sex1 = 2
record . gender_description1 = " Non-binary "
record . gender_description1 = " Non-binary "
end
end
it " shows the interruption screen " do
it " shows the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range? ) . to be true
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be true
end
end
end
end
@ -390,7 +462,7 @@ RSpec.describe Validations::SoftValidations do
end
end
it " does not show the interruption screen " do
it " does not show the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range ? ) . to be false
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be false
end
end
end
end
@ -405,7 +477,7 @@ RSpec.describe Validations::SoftValidations do
end
end
it " does not show the interruption screen " do
it " does not show the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range ? ) . to be false
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be false
end
end
end
end
@ -423,7 +495,7 @@ RSpec.describe Validations::SoftValidations do
end
end
it " does not show the interruption screen " do
it " does not show the interruption screen " do
expect ( record . non_males_in_pregnant_household_not_in_pregnancy_range ? ) . to be false
expect ( record . no_household_member_likely_to_be_pregnant ? ) . to be false
end
end
end
end
end
end