Skip to content

Commit dd0f3cc

Browse files
committed
Add conditional content to email
1 parent fad702d commit dd0f3cc

File tree

6 files changed

+228
-4
lines changed

6 files changed

+228
-4
lines changed

app/views/screener_mailer/send_screener_results.html.erb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,46 @@
7474
<li><%= t('views.screener_mailer.send_screener_results.call_office', phone: phone) %></li>
7575
<% end %>
7676
</ul>
77+
78+
<h3 style="font-weight: bold;">
79+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.title') %>
80+
</h3>
81+
82+
<p>
83+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.help_text') %>
84+
</p>
85+
86+
<ol style="line-height: 2;">
87+
<% if @screener.is_student_yes? %>
88+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.student_html') %>
89+
<% end %>
90+
91+
<% if @screener.preventing_work_drugs_alcohol_yes? || @screener.preventing_work_medical_condition_yes? %>
92+
<li>
93+
<%= t('views.proof_guidance.edit.proof_of_health_condition_html') %>
94+
</li>
95+
<% end %>
96+
97+
<% if @screener.receiving_disability_benefits? %>
98+
<li>
99+
<%= t('views.proof_guidance.edit.proof_of_disability_benefits_html') %>
100+
<ul>
101+
<% Screener::DISABILITY_BENEFIT_ATTRIBUTES.each do |benefit| %>
102+
<% if @screener.public_send("#{benefit}_yes?") %>
103+
<li>
104+
<%= t("views.disability_benefits.edit.#{benefit}") %><% if benefit == :receiving_benefits_other && @screener.receiving_benefits_write_in.present? %>: <%= @screener.receiving_benefits_write_in %><% end %>
105+
</li>
106+
<% end %>
107+
<% end %>
108+
</ul>
109+
</li>
110+
<% end %>
111+
112+
<% if @screener.is_in_alcohol_treatment_program_yes? %>
113+
<li>
114+
<%= t('views.proof_guidance.edit.proof_of_treatment_program_html') %>
115+
</li>
116+
<% end %>
117+
</ol>
118+
119+
<p><%= t('general.gbh_team') %></p>

app/views/screener_mailer/send_screener_results.text.erb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,31 @@
3939
<% if (phone = LocationData::Counties.phone_for(state, county)).present? %>
4040
- <%= t('views.screener_mailer.send_screener_results.call_office', phone: phone) %>
4141
<% end %>
42+
43+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.title') %>
44+
45+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.help_text') %>
46+
<% if @screener.is_student_yes? %>
47+
48+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.student_text') %>
49+
<% end %>
50+
<% if @screener.preventing_work_drugs_alcohol_yes? || @screener.preventing_work_medical_condition_yes? %>
51+
52+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.health_condition_text') %>
53+
<% end %>
54+
<% if @screener.receiving_disability_benefits? %>
55+
56+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.disability_benefits_title') %>
57+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.disability_benefits_help_text') %>
58+
<% Screener::DISABILITY_BENEFIT_ATTRIBUTES.each do |benefit| %>
59+
<% if @screener.public_send("#{benefit}_yes?") %>
60+
- <%= t("views.disability_benefits.edit.#{benefit}") %><% if benefit == :receiving_benefits_other && @screener.receiving_benefits_write_in.present? %>: <%= @screener.receiving_benefits_write_in %><% end %>
61+
<% end %>
62+
<% end %>
63+
<% end %>
64+
<% if @screener.is_in_alcohol_treatment_program_yes? %>
65+
66+
<%= t('views.screener_mailer.send_screener_results.proofs_you_may_need.treatment_program_text') %>
67+
<% end %>
68+
69+
<%= t('general.gbh_team') %>

config/locales/en.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ en:
2525
switched_locale: Español
2626
this_is_optional: This is optional.
2727
work_rules: Work rules
28+
gbh_team: GetBenefitsHelp Team
2829
validations:
2930
date_missing_or_invalid: Date is missing or invalid
3031
date_must_be_in_future: Date must be in the future
@@ -369,6 +370,37 @@ en:
369370
questions_intro: If you have questions, or to find out if there are other ways to submit your form, you can contact your county's social services office.
370371
reference_code: 'Your document reference code: %{code}'
371372
subject: "[GetBenefitsHelp] Your SNAP Work Rules form"
373+
proofs_you_may_need:
374+
title: "Proofs you may need"
375+
help_text: "If you know your SNAP agency already has proof of these things, you don’t need to submit it. You can always submit your form without additional proof. Your agency may follow up to ask for these documents."
376+
student_html: |
377+
<li>
378+
<strong>Proof of attending college, university, trade school, or high school</strong>
379+
<p>Financial aid papers, an enrollment letter, a transcript, or other documents showing that you’re enrolled at least half time.</p>
380+
<p>If you are enrolled in school at least half time, other SNAP rules apply. In addition to your other exemptions, also tell your SNAP agency if any of the following are true for you. Telling your agency about these situations can help you keep your SNAP benefits:</p>
381+
<ul>
382+
<li>Have a work study job, or have been approved for work study that you intend to participate in, OR</li>
383+
<li>Care for a child younger than 12, and don’t have the child care you need for you to go to school and work, OR</li>
384+
<li>Are a single parent enrolled full-time and taking care of a child under 12</li>
385+
</ul>
386+
</li>
387+
student_text: |
388+
Proof of attending college, university, trade school, or high school
389+
Financial aid papers, an enrollment letter, a transcript, or other documents showing that you’re enrolled at least half time.
390+
If you are enrolled in school at least half time, other SNAP rules apply. In addition to your other exemptions, also tell your SNAP agency if any of the following are true for you. Telling your agency about these situations can help you keep your SNAP benefits:
391+
- Have a work study job, or have been approved for work study that you intend to participate in, OR
392+
- Care for a child younger than 12, and don’t have the child care you need for you to go to school and work, OR
393+
- Are a single parent enrolled full-time and taking care of a child under 12
394+
health_condition_text: |
395+
Proof of health conditions or disability
396+
This proof can be helpful, but may not be required.
397+
- A letter from a medical or mental health provider (for example, a doctor, nurse, social worker, or other medical professional) stating that your condition makes you unable to consistently work 20 hours per week, every week, OR
398+
- A North Carolina Medical Report form that is completed, signed, and dated by a medical or mental health provider, a member of their staff, a social worker, or another professional.
399+
disability_benefits_title: Proof of disability benefits
400+
disability_benefits_help_text: "A letter or other document showing that you receive the disability benefits you selected:"
401+
treatment_program_text: |
402+
Proof of your treatment program
403+
A document from your treatment center or program, stating that you regularly participate.
372404
training_program:
373405
edit:
374406
notice_content:

config/locales/es.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ es:
2525
switched_locale: English
2626
this_is_optional: Opcional.
2727
work_rules: Reglas de trabajo
28+
gbh_team: GetBenefitsHelp Team
2829
validations:
2930
date_missing_or_invalid: La fecha falta o no es válida
3031
date_must_be_in_future: La fecha debe ser en el futuro
@@ -369,6 +370,37 @@ es:
369370
questions_intro: 'Si tiene preguntas o desea saber si hay otras formas de enviar su formulario, puede comunicarse con la oficina de servicios sociales de su condado:'
370371
reference_code: 'Código de referencia de su documento: %{code}'
371372
subject: "[GetBenefitsHelp] Acción requerida: Envíe su formulario de exención de reglas de trabajo de SNAP"
373+
proofs_you_may_need:
374+
title: "Documentación adicional que puede necesitar"
375+
help_text: "Si sabe que su oficina de SNAP ya tiene estos documentos o comprobantes, no necesita enviarlos nuevamente. Puede enviar su formulario aunque no tenga todos los comprobantes. Su oficina de SNAP puede comunicarse con usted para solicitarlos más adelante."
376+
student_html: |
377+
<li>
378+
<strong>Comprobante de que asiste a una universidad, colegio comunitario, escuela técnica o escuela secundaria</strong>
379+
<p>Envíe documentos de ayuda financiera, una carta de inscripción, historial académico de este semestre u otros documentos que demuestren que está inscrito al menos medio tiempo.</p>
380+
<p>Si está inscrito en la escuela al menos medio tiempo, se aplican otras reglas de SNAP. Además de sus otras excepciones, también debe informar a su oficina de SNAP si usted:</p>
381+
<ul>
382+
<li>Tiene un trabajo de work-study, o ha sido aprobado para participar en uno.</li>
383+
<li>Cuida a un niño menor de 12 años y no cuenta con el cuidado infantil que necesita para poder asistir a la escuela y trabajar, o</li>
384+
<li>Es padre o madre soltero(a), está inscrito(a) tiempo completo y cuida a un niño menor de 12 años.</li>
385+
</ul>
386+
</li>
387+
student_text: |
388+
Comprobante de que asiste a una universidad, colegio comunitario, escuela técnica o escuela secundaria
389+
Envíe documentos de ayuda financiera, una carta de inscripción, historial académico de este semestre u otros documentos que demuestren que está inscrito al menos medio tiempo.
390+
Si está inscrito en la escuela al menos medio tiempo, se aplican otras reglas de SNAP. Además de sus otras excepciones, también debe informar a su oficina de SNAP si usted:
391+
- Tiene un trabajo de work-study, o ha sido aprobado para participar en uno.
392+
- Cuida a un niño menor de 12 años y no cuenta con el cuidado infantil que necesita para poder asistir a la escuela y trabajar, o
393+
- Es padre o madre soltero(a), está inscrito(a) tiempo completo y cuida a un niño menor de 12 años.
394+
health_condition_text: |
395+
Comprobante de una condición de salud o discapacidad
396+
Estos documentos puede ser útiles, pero puede que no sean obligatorios.
397+
- Una carta de un proveedor médico o de salud mental (por ejemplo, un médico, enfermero, trabajador social u otro profesional de la salud) que indique que su condición le impide trabajar de manera constante 20 horas por semana, todas las semanas, O
398+
- Un formulario de Informe Médico de Carolina del Norte, llenado y firmado por un profesional médico, un trabajador social u otro profesional de la salud.
399+
disability_benefits_title: Comprobante de beneficios por discapacidad
400+
disability_benefits_help_text: "Una carta u otro documento que demuestre que usted recibe el beneficio por discapacidad que seleccionó:"
401+
treatment_program_text: |
402+
Comprobante de su programa de tratamiento
403+
Un documento de su centro o programa de tratamiento que indique que usted participa de forma regular.
372404
training_program:
373405
edit:
374406
notice_content:

spec/mailers/screener_mailer_spec.rb

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,95 @@
22

33
RSpec.describe ScreenerMailer, type: :mailer do
44
describe "send_screener_results" do
5-
let(:outgoing_email) { create(:outgoing_email, screener: create(:screener)) }
5+
let(:screener) { create(:screener) }
6+
let(:outgoing_email) { create(:outgoing_email, screener: screener) }
67
let(:mail) { ScreenerMailer.send_screener_results(outgoing_email: outgoing_email) }
8+
let(:body) { mail.html_part.body.to_s }
79

810
it "renders the headers and body" do
9-
expect(mail.subject).to eq("[GetBenefitsHelp] Your SNAP Work Rules form")
11+
expect(mail.subject).to eq(I18n.t("views.screener_mailer.send_screener_results.subject"))
1012
expect(mail.from).to eq(["noreply@" + ENV.fetch("DOMAIN", "codeforamerica.app")])
11-
expect(mail.body.encoded).to include("Submit this form and any proof you need to your SNAP agency")
13+
expect(body).to include(I18n.t("views.screener_mailer.send_screener_results.next_step_heading"))
14+
end
15+
16+
context "proof section" do
17+
context "when is_student is yes" do
18+
let(:screener) { create(:screener, is_student: "yes") }
19+
20+
it "includes proof of education" do
21+
expect(body).to include(I18n.t("views.screener_mailer.send_screener_results.proofs_you_may_need.student_html"))
22+
end
23+
end
24+
25+
context "when is_student is not yes" do
26+
it "does not include proof of education" do
27+
expect(body).not_to include(I18n.t("views.screener_mailer.send_screener_results.proofs_you_may_need.student_html"))
28+
end
29+
end
30+
31+
context "when preventing_work_drugs_alcohol is yes" do
32+
let(:screener) { create(:screener, preventing_work_drugs_alcohol: "yes") }
33+
34+
it "includes proof of health conditions" do
35+
expect(body).to include(I18n.t("views.proof_guidance.edit.proof_of_health_condition_html"))
36+
end
37+
end
38+
39+
context "when preventing_work_medical_condition is yes" do
40+
let(:screener) { create(:screener, preventing_work_medical_condition: "yes") }
41+
42+
it "includes proof of health conditions" do
43+
expect(body).to include(I18n.t("views.proof_guidance.edit.proof_of_health_condition_html"))
44+
end
45+
end
46+
47+
context "when neither drugs nor medical condition is yes" do
48+
it "does not include proof of health conditions" do
49+
expect(body).not_to include(I18n.t("views.proof_guidance.edit.proof_of_health_condition_html"))
50+
end
51+
end
52+
53+
context "when receiving disability benefits" do
54+
let(:screener) { create(:screener, receiving_benefits_ssdi: "yes", receiving_benefits_ssi: "yes") }
55+
56+
it "includes proof of disability benefits with selected benefits" do
57+
expect(body).to include(I18n.t("views.proof_guidance.edit.proof_of_disability_benefits_html"))
58+
expect(body).to include(I18n.t("views.disability_benefits.edit.receiving_benefits_ssdi"))
59+
expect(body).to include(I18n.t("views.disability_benefits.edit.receiving_benefits_ssi"))
60+
end
61+
62+
it "does not include unselected benefits" do
63+
expect(body).not_to include(I18n.t("views.disability_benefits.edit.receiving_benefits_veterans_disability"))
64+
end
65+
end
66+
67+
context "when receiving other disability benefits with write-in" do
68+
let(:screener) { create(:screener, receiving_benefits_other: "yes", receiving_benefits_write_in: "Many bennies") }
69+
70+
it "includes the write-in text" do
71+
expect(body).to include("Many bennies")
72+
end
73+
end
74+
75+
context "when not receiving any disability benefits" do
76+
it "does not include proof of disability benefits" do
77+
expect(body).not_to include(I18n.t("views.proof_guidance.edit.proof_of_disability_benefits_html"))
78+
end
79+
end
80+
81+
context "when is_in_alcohol_treatment_program is yes" do
82+
let(:screener) { create(:screener, is_in_alcohol_treatment_program: "yes") }
83+
84+
it "includes proof of treatment program" do
85+
expect(body).to include(I18n.t("views.proof_guidance.edit.proof_of_treatment_program_html"))
86+
end
87+
end
88+
89+
context "when is_in_alcohol_treatment_program is not yes" do
90+
it "does not include proof of treatment program" do
91+
expect(body).not_to include(I18n.t("views.proof_guidance.edit.proof_of_treatment_program_html"))
92+
end
93+
end
1294
end
1395
end
1496
end

test/mailers/previews/screener_mailer_preview.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ def send_screener_results
77
last_name: "Ham",
88
state: "NC",
99
county: "Burke County",
10-
confirmation_code: "123ABC"
10+
confirmation_code: "123ABC",
11+
is_student: "yes",
12+
preventing_work_drugs_alcohol: "yes",
13+
receiving_benefits_ssdi: "yes",
14+
receiving_benefits_ssi: "yes",
15+
receiving_benefits_veterans_disability: "yes",
16+
receiving_benefits_other: "yes",
17+
is_in_alcohol_treatment_program: "yes"
1118
)
1219
outgoing_email = FactoryBot.build(:outgoing_email, screener: screener)
1320
ScreenerMailer.send_screener_results(outgoing_email: outgoing_email)

0 commit comments

Comments
 (0)