diff --git a/app/app/views/cbv/agreements/show.html.erb b/app/app/views/cbv/agreements/show.html.erb index a8411cec..cca6999d 100644 --- a/app/app/views/cbv/agreements/show.html.erb +++ b/app/app/views/cbv/agreements/show.html.erb @@ -9,6 +9,6 @@ <%= form_with(url: cbv_flow_agreement_path, builder: UswdsFormBuilder, data: { turbo: "false" }) do |f| %> - <%= f.check_box(:agreement, { 'label': t(".checkbox", agency_name: current_site.agency_name) }) %> + <%= f.check_box(:agreement, { 'label': site_translation(".checkbox") }) %> <%= f.submit t(".get_started") %> <% end %> diff --git a/app/config/locales/en.yml b/app/config/locales/en.yml index 6bb270b1..22a6eb0a 100644 --- a/app/config/locales/en.yml +++ b/app/config/locales/en.yml @@ -107,7 +107,10 @@ en: create: error: You must check the agreement checkbox to proceed. show: - checkbox: Check this box to agree to let Verify.gov access your payment information and share it with the %{agency_name}. + checkbox: + ma: Check this box to agree to let us access your payment information and share it with the Massachusetts Department of Transitional Assistance. + nyc: Check this box to agree to let Nava access your payment information and share it with New York City Human Resources Administration. We will not use the information for any other purpose nor redisclose it to any other party. + sandbox: Check this box to agree to let Verify.gov access your payment information and share it with the Sandbox Example Agency. get_started: Get started header: How verifying your income works step1: Find your employer or online payroll provider. A payroll provider is the company where you check your paystubs online diff --git a/app/spec/controllers/cbv/agreements_controller_spec.rb b/app/spec/controllers/cbv/agreements_controller_spec.rb index 8689d5c7..27df2cc5 100644 --- a/app/spec/controllers/cbv/agreements_controller_spec.rb +++ b/app/spec/controllers/cbv/agreements_controller_spec.rb @@ -3,26 +3,51 @@ RSpec.describe Cbv::AgreementsController do render_views - let(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", site_id: "sandbox") } + let(:cbv_flow) { create(:cbv_flow) } before do session[:cbv_flow_id] = cbv_flow.id end - it "renders properly" do - get :show + describe "#show" do + it "renders properly" do + get :show + expect(response).to be_successful + end - expect(response).to be_successful - end + context "shows different agreements based on the site_id" do + it "when site is nyc" do + cbv_flow.update(site_id: "nyc") + get :show + expect(response.body).to include I18n.t("cbv.agreements.show.checkbox.nyc") + end - it "displays error when the checkbox is not checked" do - post :create, params: {} - expect(flash[:alert]).to be_present - expect(response).to redirect_to(cbv_flow_agreement_path) - end + it "when site is ma" do + cbv_flow.update(site_id: "ma") + get :show + expect(response.body).to include I18n.t("cbv.agreements.show.checkbox.ma") + end + + it "when site is sandbox" do + cbv_flow.update(site_id: "sandbox") + get :show + expect(response.body).to include I18n.t("cbv.agreements.show.checkbox.sandbox") + end + end + + context "when the user has not agreed to the terms" do + it "displays error when the checkbox is not checked" do + post :create, params: {} + expect(flash[:alert]).to be_present + expect(response).to redirect_to(cbv_flow_agreement_path) + end + end - it "redirects when checkbox is checked" do - post :create, params: { 'agreement': '1' } - expect(response).to redirect_to(cbv_flow_employer_search_path) + context "when the user has agreed to the terms" do + it "redirects when checkbox is checked" do + post :create, params: { 'agreement': '1' } + expect(response).to redirect_to(cbv_flow_employer_search_path) + end + end end end