@ -83,62 +83,78 @@ RSpec.describe Validations::SoftValidations do
end
end
describe " retirement soft validations " do
describe " retirement soft validations " do
context " when the tenant is retired but under the expected retirement age " do
before do
it " shows the interruption screen " do
record . update! ( age1 : , ecstat1 : )
record . update! ( age1 : 43 , ecstat1 : 5 )
end
expect ( record . person_1_retired_under_soft_min_age? ) . to be true
context " when the tenant is under the expected retirement age " do
let ( :age1 ) { 60 }
context " and the tenant's economic status is nil " do
let ( :ecstat1 ) { nil }
it " does not show the interruption screen " do
expect ( record ) . not_to be_person_1_retired_under_soft_min_age
end
end
end
end
context " when the tenant is not retired but over the expected retirement age " do
context " and the tenant is retired " do
context " when the tenant is female " do
let ( :ecstat1 ) { 5 }
it " shows the interruption screen " do
record . update! ( age1 : 85 , sex1 : " F " , ecstat1 : 3 )
it " does show the interruption screen " do
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be true
expect ( record ) . to be_person_1_retired_under_soft_min_ag e
end
end
end
end
context " when the tenant is male " do
context " and the tenant is not retired " do
it " shows the interruption screen " do
let ( :ecstat1 ) { 3 }
record . update! ( age1 : 85 , sex1 : " M " , ecstat1 : 3 )
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be true
it " does not show the interruption screen " do
expect ( record ) . not_to be_person_1_retired_under_soft_min_age
end
end
end
end
context " when the tenant is non-binary " do
context " and the tenant prefers not to say " do
it " shows the interruption screen " do
let ( :ecstat1 ) { 10 }
record . update! ( age1 : 85 , sex1 : " X " , ecstat1 : 3 )
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be true
it " does not show the interruption screen " do
expect ( record ) . not_to be_person_1_retired_under_soft_min_age
end
end
end
end
end
end
context " when the tenant prefers not to say what their economic status is but is under the expected retirement age " do
context " when the tenant is over the expected retirement age " do
let ( :age1 ) { 70 }
context " and the tenant's economic status is nil " do
let ( :ecstat1 ) { nil }
it " does not show the interruption screen " do
it " does not show the interruption screen " do
record . update! ( age1 : 43 , ecstat1 : 10 )
expect ( record ) . not_to be_person_1_not_retired_over_soft_max_age
expect ( record . person_1_retired_under_soft_min_age? ) . to be false
end
end
end
end
context " when the tenant prefers not to say what their economic status is but is over the expected retirement age " do
context " and the tenant is retired " do
context " when the tenant is female " do
let ( :ecstat1 ) { 5 }
it " does not show the interruption screen " do
it " does not show the interruption screen " do
record . update! ( age1 : 85 , sex1 : " F " , ecstat1 : 10 )
expect ( record ) . not_to be_person_1_not_retired_over_soft_max_age
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be false
end
end
end
end
context " when the tenant is male " do
context " and the tenant is not retired " do
it " does not show the interruption screen " do
let ( :ecstat1 ) { 3 }
record . update! ( age1 : 85 , sex1 : " M " , ecstat1 : 10 )
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be false
it " does show the interruption screen " do
expect ( record ) . to be_person_1_not_retired_over_soft_max_age
end
end
end
end
context " when the tenant is non-binary " do
context " and the tenant prefers not to say " do
let ( :ecstat1 ) { 10 }
it " does not show the interruption screen " do
it " does not show the interruption screen " do
record . update! ( age1 : 85 , sex1 : " X " , ecstat1 : 10 )
expect ( record ) . not_to be_person_1_not_retired_over_soft_max_age
expect ( record . person_1_not_retired_over_soft_max_age? ) . to be false
end
end
end
end
end
end