diff --git a/README.md b/README.md
index d33f86aca..507aea1dd 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ guide for an introduction to the framework.
* Chromedriver must be allowed to run. You can either do that by:
* The command line: `xattr -d com.apple.quarantine $(which chromedriver)` (this is the only option if you are on Big Sur)
* Manually: clicking "allow" when you run the integration tests for the first time and a dialogue opens up
- * [Ngrok](https://ngrok.com/download): brew install ngrok/ngrok/ngrok
+ * [Ngrok](https://ngrok.com/downloads): brew install ngrok/ngrok/ngrok
* Sign up for an account: https://dashboard.ngrok.com/signup
* run `ngrok config add-authtoken {token goes here}`
1. Set up rbenv and nodenv:
@@ -109,21 +109,21 @@ $ i18n-tasks remove-unused # removes unused keys across locale files
For more information on usage and helpful rake tasks to manage locale files, see [the documentation](https://github.com/glebm/i18n-tasks#usage).
-## "Site-specific" translations
+## "Client Agency-specific" translations
The CBV pilot project is architected to be multi-tenant across jurisdictions we
are actively piloting with. Each jurisdiction's agency is configured as a
-"site" in app/config/site-config.yml and has a short "id", e.g. "nyc", "ma",
+"client agency" in app/config/client-agency-config.yml and has a short "id", e.g. "nyc", "ma",
and "sandbox".
-We often need to adjust copy specific to each site. The preferred way to do it
-is by using the `site_translation` helper, which wraps Rails's `t` view helper
-and looks for the current site's "id" as a sub-key of the given prefix.
+We often need to adjust copy specific to each client agency. The preferred way to do it
+is by using the `client_agency_translation` helper, which wraps Rails's `t` view helper
+and looks for the current client agency's "id" as a sub-key of the given prefix.
Usage:
```erb
-<%= site_translation(".learn_more_html") %>
+<%= client_agency_translation(".learn_more_html") %>
```
And the corresponding locale file:
@@ -214,7 +214,7 @@ If you're new to CBV, here's a summary of how to get started navigating the app.
1. Search for your employer. When you select one, the local page will show you some fake credentials at the very bottom of the screen. Use these to sign in.
1. Finally, you should be able to complete the applicant flow, including looking at the PDF.
1. To complete the caseworker flow, add `?is_caseworker=true` to the /cbv/summary.pdf path to see the PDF that gets sent (it's different from the one we send the applicant!)
-1. Note: You can switch to a different pilot partner (state) by going to the irb prompt and running `CbvFlow.last.update(site_id: 'ma')`. Right now you can only pass it `ma` or `nyc`.
+1. Note: You can switch to a different pilot partner (state) by going to the irb prompt and running `CbvFlow.last.update(client_agency_id: 'ma')`. Right now you can only pass it `ma` or `nyc`.
## Pa11y Scan
diff --git a/app/app/controllers/api/invitations_controller.rb b/app/app/controllers/api/invitations_controller.rb
index 08dfca0d6..2db732e63 100644
--- a/app/app/controllers/api/invitations_controller.rb
+++ b/app/app/controllers/api/invitations_controller.rb
@@ -33,12 +33,12 @@ def cbv_flow_invitation_params
:agency_id_number,
:beacon_id,
:user_id,
- :site_id
+ :client_agency_id
)
end
- def site_id
- cbv_flow_invitation_params[:site_id]
+ def client_agency_id
+ cbv_flow_invitation_params[:client_agency_id]
end
private
diff --git a/app/app/controllers/application_controller.rb b/app/app/controllers/application_controller.rb
index 261136b44..1ef0977f6 100644
--- a/app/app/controllers/application_controller.rb
+++ b/app/app/controllers/application_controller.rb
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
helper :view
- helper_method :current_site, :show_translate_button?, :show_menu?
+ helper_method :current_agency, :show_translate_button?, :show_menu?
around_action :switch_locale
before_action :add_newrelic_metadata
before_action :redirect_if_maintenance_mode
@@ -12,11 +12,11 @@ class ApplicationController < ActionController::Base
end
def after_sign_in_path_for(user)
- caseworker_dashboard_path(site_id: user.site_id)
+ caseworker_dashboard_path(client_agency_id: user.client_agency_id)
end
def after_sign_out_path_for(resource_or_scope)
- new_user_session_path(site_id: params[:site_id])
+ new_user_session_path(client_agency_id: params[:client_agency_id])
end
def switch_locale(&action)
@@ -25,8 +25,8 @@ def switch_locale(&action)
I18n.with_locale(locale, &action)
end
- def site_config
- Rails.application.config.sites
+ def agency_config
+ Rails.application.config.client_agencies
end
private
@@ -45,8 +45,8 @@ def home_page?
request.path == root_path
end
- def current_site
- @current_site ||= site_config[params[:site_id]]
+ def current_agency
+ @current_agency ||= agency_config[params[:client_agency_id]]
end
def enable_mini_profiler_in_demo
@@ -62,7 +62,7 @@ def demo_mode?
protected
def pinwheel_for(cbv_flow)
- environment = site_config[cbv_flow.site_id].pinwheel_environment
+ environment = agency_config[cbv_flow.client_agency_id].pinwheel_environment
PinwheelService.new(environment)
end
@@ -71,7 +71,7 @@ def add_newrelic_metadata
attributes = {
cbv_flow_id: session[:cbv_flow_id],
session_id: session.id.to_s,
- site_id: params[:site_id],
+ client_agency_id: params[:client_agency_id],
locale: params[:locale],
user_id: current_user.try(:id)
}
diff --git a/app/app/controllers/caseworker/base_controller.rb b/app/app/controllers/caseworker/base_controller.rb
index b99b2c663..450df80b9 100644
--- a/app/app/controllers/caseworker/base_controller.rb
+++ b/app/app/controllers/caseworker/base_controller.rb
@@ -4,7 +4,7 @@ class Caseworker::BaseController < ApplicationController
def authenticate_user!
super
- unless current_user.site_id == params[:site_id]
+ unless current_user.client_agency_id == params[:client_agency_id]
redirect_to root_url, flash: {
slim_alert: { message: t("shared.error_unauthorized"), type: "error" }
}
@@ -12,7 +12,7 @@ def authenticate_user!
end
def redirect_if_disabled
- unless current_site.staff_portal_enabled
+ unless current_agency.staff_portal_enabled
redirect_to root_url, flash: {
slim_alert: { message: I18n.t("caseworker.entries.disabled"), type: "error" }
}
diff --git a/app/app/controllers/caseworker/cbv_flow_invitations_controller.rb b/app/app/controllers/caseworker/cbv_flow_invitations_controller.rb
index ba32aa661..a9940f3d6 100644
--- a/app/app/controllers/caseworker/cbv_flow_invitations_controller.rb
+++ b/app/app/controllers/caseworker/cbv_flow_invitations_controller.rb
@@ -5,16 +5,16 @@ class Caseworker::CbvFlowInvitationsController < Caseworker::BaseController
helper_method :language_options
def new
- @site_id = site_id
- @cbv_flow_invitation = CbvFlowInvitation.new(site_id: site_id)
+ @client_agency_id = client_agency_id
+ @cbv_flow_invitation = CbvFlowInvitation.new(client_agency_id: client_agency_id)
- if @site_id == "ma"
+ if @client_agency_id == "ma"
@cbv_flow_invitation.snap_application_date ||= Date.today
end
end
def create
- invitation_params = base_params.merge(site_specific_params)
+ invitation_params = base_params.merge(client_agency_specific_params)
# handle errors from the mail service
begin
@cbv_flow_invitation = CbvInvitationService.new(event_logger).invite(
@@ -27,7 +27,7 @@ def create
flash[:alert] = t(".invite_failed",
email_address: cbv_flow_invitation_params[:email_address],
error_message: e.message)
- return redirect_to caseworker_dashboard_path(site_id: params[:site_id])
+ return redirect_to caseworker_dashboard_path(client_agency_id: params[:client_agency_id])
end
if @cbv_flow_invitation.errors.any?
@@ -51,7 +51,7 @@ def create
message: t(".invite_success", email_address: cbv_flow_invitation_params[:email_address]),
type: "success"
}
- redirect_to caseworker_dashboard_path(site_id: params[:site_id])
+ redirect_to caseworker_dashboard_path(client_agency_id: params[:client_agency_id])
end
private
@@ -63,8 +63,8 @@ def language_options
end
def ensure_valid_params!
- if site_config.site_ids.exclude?(site_id)
- flash[:alert] = t("caseworker.cbv_flow_invitations.incorrect_site_id")
+ if agency_config.client_agency_ids.exclude?(client_agency_id)
+ flash[:alert] = t("caseworker.cbv_flow_invitations.incorrect_client_agency_id")
redirect_to root_url
end
end
@@ -77,11 +77,11 @@ def base_params
:last_name,
:email_address,
:snap_application_date,
- ).merge(site_id: site_id)
+ ).merge(client_agency_id: client_agency_id)
end
- def site_specific_params
- case site_id
+ def client_agency_specific_params
+ case client_agency_id
when "ma"
cbv_flow_invitation_params.slice(:agency_id_number, :beacon_id)
when "nyc"
@@ -106,7 +106,7 @@ def cbv_flow_invitation_params
)
end
- def site_id
- params[:site_id]
+ def client_agency_id
+ params[:client_agency_id]
end
end
diff --git a/app/app/controllers/caseworker/entries_controller.rb b/app/app/controllers/caseworker/entries_controller.rb
index 78c5590e4..e099f541c 100644
--- a/app/app/controllers/caseworker/entries_controller.rb
+++ b/app/app/controllers/caseworker/entries_controller.rb
@@ -1,5 +1,5 @@
class Caseworker::EntriesController < Caseworker::BaseController
def index
- @current_site = current_site
+ @current_agency = current_agency
end
end
diff --git a/app/app/controllers/cbv/base_controller.rb b/app/app/controllers/cbv/base_controller.rb
index 0d9337c1e..5bc415622 100644
--- a/app/app/controllers/cbv/base_controller.rb
+++ b/app/app/controllers/cbv/base_controller.rb
@@ -1,6 +1,6 @@
class Cbv::BaseController < ApplicationController
before_action :set_cbv_flow, :ensure_cbv_flow_not_yet_complete, :prevent_back_after_complete, :capture_page_view
- helper_method :agency_url, :next_path, :get_comment_by_account_id, :current_site
+ helper_method :agency_url, :next_path, :get_comment_by_account_id, :current_agency
private
@@ -16,10 +16,10 @@ def set_cbv_flow
end
if invitation.expired?
track_expired_event(invitation)
- return redirect_to(cbv_flow_expired_invitation_path(site_id: invitation.site_id))
+ return redirect_to(cbv_flow_expired_invitation_path(client_agency_id: invitation.client_agency_id))
end
if invitation.complete?
- return redirect_to(cbv_flow_expired_invitation_path(site_id: invitation.site_id))
+ return redirect_to(cbv_flow_expired_invitation_path(client_agency_id: invitation.client_agency_id))
end
@cbv_flow = CbvFlow.create_from_invitation(invitation)
@@ -44,10 +44,10 @@ def ensure_cbv_flow_not_yet_complete
redirect_to(cbv_flow_success_path)
end
- def current_site
- return unless @cbv_flow.present? && @cbv_flow.site_id.present?
+ def current_agency
+ return unless @cbv_flow.present? && @cbv_flow.client_agency_id.present?
- @current_site ||= site_config[@cbv_flow.site_id]
+ @current_site ||= agency_config[@cbv_flow.client_agency_id]
end
def next_path
@@ -72,7 +72,7 @@ def pinwheel
end
def agency_url
- current_site&.agency_contact_website
+ current_agency&.agency_contact_website
end
def get_comment_by_account_id(account_id)
@@ -90,7 +90,7 @@ def capture_page_view
event_logger.track("CbvPageView", request, {
cbv_flow_id: @cbv_flow.id,
invitation_id: @cbv_flow.cbv_flow_invitation_id,
- site_id: @cbv_flow.site_id,
+ client_agency_id: @cbv_flow.client_agency_id,
path: request.path
})
rescue => ex
@@ -121,7 +121,7 @@ def track_invitation_clicked_event(invitation, cbv_flow)
timestamp: Time.now.to_i,
invitation_id: invitation.id,
cbv_flow_id: cbv_flow.id,
- site_id: cbv_flow.site_id,
+ client_agency_id: cbv_flow.client_agency_id,
seconds_since_invitation: (Time.now - invitation.created_at).to_i
})
rescue => ex
diff --git a/app/app/controllers/cbv/entries_controller.rb b/app/app/controllers/cbv/entries_controller.rb
index 3af160644..3033377c0 100644
--- a/app/app/controllers/cbv/entries_controller.rb
+++ b/app/app/controllers/cbv/entries_controller.rb
@@ -2,7 +2,7 @@ class Cbv::EntriesController < Cbv::BaseController
def show
event_logger.track("ApplicantViewedAgreement", request, {
timestamp: Time.now.to_i,
- site_id: @cbv_flow.site_id,
+ client_agency_id: @cbv_flow.client_agency_id,
cbv_flow_id: @cbv_flow.id,
invitation_id: @cbv_flow.cbv_flow_invitation_id
})
@@ -12,7 +12,7 @@ def create
if params["agreement"] == "1"
event_logger.track("ApplicantAgreed", request, {
timestamp: Time.now.to_i,
- site_id: @cbv_flow.site_id,
+ client_agency_id: @cbv_flow.client_agency_id,
cbv_flow_id: @cbv_flow.id,
invitation_id: @cbv_flow.cbv_flow_invitation_id
})
diff --git a/app/app/controllers/cbv/expired_invitations_controller.rb b/app/app/controllers/cbv/expired_invitations_controller.rb
index 3574071a8..98eccd101 100644
--- a/app/app/controllers/cbv/expired_invitations_controller.rb
+++ b/app/app/controllers/cbv/expired_invitations_controller.rb
@@ -1,15 +1,15 @@
class Cbv::ExpiredInvitationsController < Cbv::BaseController
skip_before_action :set_cbv_flow, :ensure_cbv_flow_not_yet_complete
- helper_method :current_site
+ helper_method :current_agency
def show
end
private
- def current_site
- return unless Rails.application.config.sites.site_ids.include?(params[:site_id])
+ def current_agency
+ return unless Rails.application.config.client_agencies.client_agency_ids.include?(params[:client_agency_id])
- Rails.application.config.sites[params[:site_id]]
+ Rails.application.config.client_agencies[params[:client_agency_id]]
end
end
diff --git a/app/app/controllers/cbv/summaries_controller.rb b/app/app/controllers/cbv/summaries_controller.rb
index f0e28c818..b59c4a8c2 100644
--- a/app/app/controllers/cbv/summaries_controller.rb
+++ b/app/app/controllers/cbv/summaries_controller.rb
@@ -23,7 +23,7 @@ def show
format.pdf do
event_logger.track("ApplicantDownloadedIncomePDF", request, {
timestamp: Time.now.to_i,
- site_id: @cbv_flow.site_id,
+ client_agency_id: @cbv_flow.client_agency_id,
cbv_flow_id: @cbv_flow.id,
invitation_id: @cbv_flow.cbv_flow_invitation_id,
locale: I18n.locale
@@ -56,12 +56,12 @@ def update
end
if @cbv_flow.confirmation_code.blank?
- confirmation_code = generate_confirmation_code(@cbv_flow.site_id)
+ confirmation_code = generate_confirmation_code(@cbv_flow.client_agency_id)
@cbv_flow.update(confirmation_code: confirmation_code)
end
- if !current_site.transmission_method.present?
- Rails.logger.info("No transmission method found for site #{current_site.id}")
+ if !current_agency.transmission_method.present?
+ Rails.logger.info("No transmission method found for client agency #{current_agency.id}")
else
transmit_to_caseworker
end
@@ -77,10 +77,10 @@ def has_consent
end
def transmit_to_caseworker
- case current_site.transmission_method
+ case current_agency.transmission_method
when "shared_email"
CaseworkerMailer.with(
- email_address: current_site.transmission_method_configuration.dig("email"),
+ email_address: current_agency.transmission_method_configuration.dig("email"),
cbv_flow: @cbv_flow,
payments: @payments,
employments: @employments,
@@ -90,7 +90,7 @@ def transmit_to_caseworker
@cbv_flow.touch(:transmitted_at)
track_transmitted_event(@cbv_flow, @payments)
when "s3"
- config = current_site.transmission_method_configuration
+ config = current_agency.transmission_method_configuration
public_key = config["public_key"]
if public_key.blank?
@@ -158,7 +158,7 @@ def transmit_to_caseworker
tmp_encrypted_tar.close! if tmp_encrypted_tar
end
else
- raise "Unsupported transmission method: #{current_site.transmission_method}"
+ raise "Unsupported transmission method: #{current_agency.transmission_method}"
end
end
@@ -190,7 +190,7 @@ def generate_csv
def track_transmitted_event(cbv_flow, payments)
event_logger.track("ApplicantSharedIncomeSummary", request, {
timestamp: Time.now.to_i,
- site_id: cbv_flow.site_id,
+ client_agency_id: cbv_flow.client_agency_id,
cbv_flow_id: cbv_flow.id,
invitation_id: cbv_flow.cbv_flow_invitation_id,
account_count: payments.map { |p| p[:account_id] }.uniq.count,
@@ -207,7 +207,7 @@ def track_transmitted_event(cbv_flow, payments)
def track_accessed_income_summary_event(cbv_flow, payments)
event_logger.track("ApplicantAccessedIncomeSummary", request, {
timestamp: Time.now.to_i,
- site_id: cbv_flow.site_id,
+ client_agency_id: cbv_flow.client_agency_id,
cbv_flow_id: cbv_flow.id,
invitation_id: cbv_flow.cbv_flow_invitation_id,
account_count: payments.map { |p| p.account_id }.uniq.count,
diff --git a/app/app/controllers/help_controller.rb b/app/app/controllers/help_controller.rb
index ca0c58071..4d0b8d936 100644
--- a/app/app/controllers/help_controller.rb
+++ b/app/app/controllers/help_controller.rb
@@ -1,6 +1,6 @@
class HelpController < ApplicationController
layout "help"
- helper_method :current_site
+ helper_method :current_agency
def index
@title = t("help.index.title")
@@ -16,7 +16,7 @@ def show
topic: @help_topic,
cbv_flow_id: session[:cbv_flow_id],
invitation_id: cbv_flow&.cbv_flow_invitation_id,
- site_id: current_site&.id,
+ client_agency_id: current_agency&.id,
flow_started_seconds_ago: cbv_flow ? (Time.now - cbv_flow.created_at).to_i : nil,
language: I18n.locale
}.compact)
@@ -26,14 +26,14 @@ def show
private
- def current_site
- @current_site ||= find_site_from_flow || site_config[params[:site_id]]
+ def current_agency
+ @current_agency ||= find_site_from_flow || agency_config[params[:client_agency_id]]
end
def find_site_from_flow
return unless session[:cbv_flow_id]
cbv_flow = CbvFlow.find_by(id: session[:cbv_flow_id])
- site_config[cbv_flow.site_id] if cbv_flow
+ agency_config[cbv_flow.client_agency_id] if cbv_flow
end
end
diff --git a/app/app/controllers/users/omniauth_callbacks_controller.rb b/app/app/controllers/users/omniauth_callbacks_controller.rb
index 8f920a3de..4ae7d009e 100644
--- a/app/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/app/controllers/users/omniauth_callbacks_controller.rb
@@ -32,10 +32,10 @@ def sandbox
private
- def login_with_oauth(email, site_id)
+ def login_with_oauth(email, client_agency_id)
# TODO: Check that the email is permissible according to its domain
- @user = User.find_for_authentication(email: email, site_id: site_id)
- @user ||= User.create(email: email, site_id: site_id)
+ @user = User.find_for_authentication(email: email, client_agency_id: client_agency_id)
+ @user ||= User.create(email: email, client_agency_id: client_agency_id)
if @user&.persisted?
flash[:slim_alert] = { message: t("users.omniauth_callbacks.authentication_successful"), type: "info" }
@@ -45,8 +45,8 @@ def login_with_oauth(email, site_id)
end
end
- def authorized?(email, site)
- authorized_emails = Rails.application.config.sites["ma"].authorized_emails&.split(",").map(&:downcase)
+ def authorized?(email, client_agency)
+ authorized_emails = Rails.application.config.client_agencies["ma"].authorized_emails&.split(",").map(&:downcase)
unless authorized_emails.blank?
authorized_emails.include?(email.downcase)
@@ -57,7 +57,7 @@ def track_event
return unless @user&.persisted?
event_logger.track("CaseworkerLogin", request, {
- site_id: @user.site_id,
+ client_agency_id: @user.client_agency_id,
user_id: @user.id
})
end
@@ -65,11 +65,11 @@ def track_event
def after_omniauth_failure_path_for(scope)
case failed_strategy.name
when "sandbox"
- new_user_session_path(site_id: "sandbox")
+ new_user_session_path(client_agency_id: "sandbox")
when "nyc_dss"
- new_user_session_path(site_id: "nyc")
+ new_user_session_path(client_agency_id: "nyc")
when "ma_dta"
- new_user_session_path(site_id: "ma")
+ new_user_session_path(client_agency_id: "ma")
end
end
end
diff --git a/app/app/helpers/application_helper.rb b/app/app/helpers/application_helper.rb
index 77cfaa8d3..bbc8d0982 100644
--- a/app/app/helpers/application_helper.rb
+++ b/app/app/helpers/application_helper.rb
@@ -1,28 +1,28 @@
module ApplicationHelper
- def current_site?(site_id)
- return false if current_site.nil?
+ def current_agency?(client_agency_id)
+ return false if current_agency.nil?
- current_site.id.to_sym == site_id.to_sym
+ current_agency.id.to_sym == client_agency_id.to_sym
end
- # Render a translation that is specific to the current site. Define
- # site-specific translations as:
+ # Render a translation that is specific to the current client agency. Define
+ # client agency-specific translations as:
#
# foo:
# nyc: Some String
# ma: Other String
# default: Default String
#
- # Then call this method with, `site_translation("foo")` and it will attempt
- # to render the nested translation according to the site returned by a
- # `current_site` method defined by your controller/mailer. If the translation
- # is either missing or there is no current site, it will attempt to render a
+ # Then call this method with, `agency_translation("foo")` and it will attempt
+ # to render the nested translation according to the client agency returned by a
+ # `current_agency` method defined by your controller/mailer. If the translation
+ # is either missing or there is no current client agency, it will attempt to render a
# "default" key.
- def site_translation(i18n_base_key, **options)
+ def agency_translation(i18n_base_key, **options)
default_key = "#{i18n_base_key}.default"
i18n_key =
- if current_site
- "#{i18n_base_key}.#{current_site.id}"
+ if current_agency
+ "#{i18n_base_key}.#{current_agency.id}"
else
default_key
end
@@ -59,8 +59,8 @@ def site_translation(i18n_base_key, **options)
def feedback_form_url
case params[:controller]
when %r{^caseworker/}
- if current_site && current_site.caseworker_feedback_form
- current_site.caseworker_feedback_form
+ if current_agency && current_agency.caseworker_feedback_form.present?
+ current_agency.caseworker_feedback_form
else
APPLICANT_FEEDBACK_FORM
end
diff --git a/app/app/mailers/applicant_mailer.rb b/app/app/mailers/applicant_mailer.rb
index 505e955f4..8770d48ef 100644
--- a/app/app/mailers/applicant_mailer.rb
+++ b/app/app/mailers/applicant_mailer.rb
@@ -1,19 +1,19 @@
class ApplicantMailer < ApplicationMailer
helper :view, :application
- helper_method :current_site
+ helper_method :current_agency
before_action :set_params
around_action :set_locale
def invitation_email
mail(
to: @cbv_flow_invitation.email_address,
- subject: view_context.site_translation("applicant_mailer.invitation_email.subject")
+ subject: view_context.agency_translation("applicant_mailer.invitation_email.subject")
)
end
def invitation_reminder_email
mail(
to: @cbv_flow_invitation.email_address,
- subject: view_context.site_translation("applicant_mailer.invitation_reminder_email.subject")
+ subject: view_context.agency_translation("applicant_mailer.invitation_reminder_email.subject")
)
end
@@ -27,7 +27,7 @@ def set_params
@cbv_flow_invitation = params[:cbv_flow_invitation]
end
- def current_site
- site_config[@cbv_flow_invitation.site_id]
+ def current_agency
+ client_agency_config[@cbv_flow_invitation.client_agency_id]
end
end
diff --git a/app/app/mailers/application_mailer.rb b/app/app/mailers/application_mailer.rb
index 24d434b7d..82a2b8744 100644
--- a/app/app/mailers/application_mailer.rb
+++ b/app/app/mailers/application_mailer.rb
@@ -3,8 +3,8 @@ class ApplicationMailer < ActionMailer::Base
layout "mailer"
after_deliver :track_delivery
- def site_config
- Rails.application.config.sites
+ def client_agency_config
+ Rails.application.config.client_agencies
end
private
diff --git a/app/app/mailers/caseworker_mailer.rb b/app/app/mailers/caseworker_mailer.rb
index 9f0b0350f..b63b143eb 100644
--- a/app/app/mailers/caseworker_mailer.rb
+++ b/app/app/mailers/caseworker_mailer.rb
@@ -1,7 +1,7 @@
class CaseworkerMailer < ApplicationMailer
helper "cbv/pinwheel_data"
helper :view, :application
- helper_method :current_site
+ helper_method :current_agency
before_action :set_params
def summary_email
@@ -37,7 +37,7 @@ def generate_pdf
end
end
- def current_site
- site_config[@cbv_flow.site_id]
+ def current_agency
+ client_agency_config[@cbv_flow.client_agency_id]
end
end
diff --git a/app/app/mailers/weekly_report_mailer.rb b/app/app/mailers/weekly_report_mailer.rb
index 1106943e2..ca11c2daa 100644
--- a/app/app/mailers/weekly_report_mailer.rb
+++ b/app/app/mailers/weekly_report_mailer.rb
@@ -4,17 +4,17 @@ class WeeklyReportMailer < ApplicationMailer
# Send email with a CSV file that reports on completed flows in past week
def report_email
- current_site = site_config[params[:site_id]]
- raise "Invalid `site_id` parameter given: #{params[:site_id].inspect}" unless current_site.present?
+ current_agency = client_agency_config[params[:client_agency_id]]
+ raise "Invalid `client_agency_id` parameter given: #{params[:client_agency_id].inspect}" unless current_agency.present?
raise "Missing `report_date` param" unless params[:report_date].present?
now = params[:report_date]
- raise "Missing `weekly_report.recipient` configuration for site: #{params[:site_id]}" unless current_site.weekly_report["recipient"]
- @recipient = current_site.weekly_report["recipient"]
+ raise "Missing `weekly_report.recipient` configuration for client agency: #{params[:client_agency_id]}" unless current_agency.weekly_report["recipient"]
+ @recipient = current_agency.weekly_report["recipient"]
@report_range = now.prev_week.all_week
- csv_rows = weekly_report_data(current_site, @report_range)
+ csv_rows = weekly_report_data(current_agency, @report_range)
attachments[report_filename(@report_range)] = generate_csv(csv_rows)
mail(
@@ -29,9 +29,9 @@ def report_filename(report_range)
"weekly_report_#{report_range.begin.strftime("%Y%m%d")}-#{report_range.end.strftime("%Y%m%d")}.csv"
end
- def weekly_report_data(current_site, report_range)
+ def weekly_report_data(current_agency, report_range)
CbvFlowInvitation
- .where(site_id: current_site.id)
+ .where(client_agency_id: current_agency.id)
.where(created_at: report_range)
.includes(:cbv_flows)
.map do |invitation|
@@ -45,7 +45,7 @@ def weekly_report_data(current_site, report_range)
email_address: invitation.email_address
}
- case current_site.id
+ case current_agency.id
when "nyc"
base_fields.merge(
client_id_number: invitation.client_id_number,
diff --git a/app/app/models/cbv_flow.rb b/app/app/models/cbv_flow.rb
index cd72c69e0..a3f5d06b5 100644
--- a/app/app/models/cbv_flow.rb
+++ b/app/app/models/cbv_flow.rb
@@ -2,7 +2,7 @@ class CbvFlow < ApplicationRecord
has_many :pinwheel_accounts, dependent: :destroy
belongs_to :cbv_flow_invitation, optional: true
belongs_to :cbv_client, optional: true
- validates :site_id, inclusion: Rails.application.config.sites.site_ids
+ validates :client_agency_id, inclusion: Rails.application.config.client_agencies.client_agency_ids
scope :incomplete, -> { where(confirmation_code: nil) }
@@ -21,7 +21,7 @@ def self.create_from_invitation(cbv_flow_invitation)
create(
cbv_flow_invitation: cbv_flow_invitation,
case_number: cbv_flow_invitation.case_number,
- site_id: cbv_flow_invitation.site_id
+ client_agency_id: cbv_flow_invitation.client_agency_id
)
end
diff --git a/app/app/models/cbv_flow_invitation.rb b/app/app/models/cbv_flow_invitation.rb
index 7eaeaa568..d73645325 100644
--- a/app/app/models/cbv_flow_invitation.rb
+++ b/app/app/models/cbv_flow_invitation.rb
@@ -38,7 +38,7 @@ class CbvFlowInvitation < ApplicationRecord
before_validation :format_case_number, if: :nyc_site?
before_validation :normalize_language
- validates :site_id, inclusion: Rails.application.config.sites.site_ids
+ validates :client_agency_id, inclusion: Rails.application.config.client_agencies.client_agency_ids
validates :first_name, presence: true
validates :last_name, presence: true
validates :email_address, format: { with: EMAIL_REGEX, message: :invalid_format }
@@ -81,7 +81,7 @@ class CbvFlowInvitation < ApplicationRecord
# after sending the invitation.
def expires_at
end_of_day_sent = created_at.in_time_zone(INVITATION_VALIDITY_TIME_ZONE).end_of_day
- days_valid_for = Rails.application.config.sites[site_id].invitation_valid_days
+ days_valid_for = Rails.application.config.client_agencies[client_agency_id].invitation_valid_days
end_of_day_sent + days_valid_for.days
end
@@ -105,11 +105,11 @@ def paystubs_query_begins_at
private
def nyc_site?
- site_id == "nyc"
+ client_agency_id == "nyc"
end
def ma_site?
- site_id == "ma"
+ client_agency_id == "ma"
end
def parse_snap_application_date
@@ -126,7 +126,7 @@ def parse_snap_application_date
new_date_format = Date.strptime(raw_snap_application_date.to_s, "%m/%d/%Y")
self.snap_application_date = new_date_format
rescue Date::Error => e
- case site_id
+ case client_agency_id
when "ma"
error = :ma_invalid_date
when "nyc"
diff --git a/app/app/services/cbv_invitation_service.rb b/app/app/services/cbv_invitation_service.rb
index de8928c24..4fe7ef211 100644
--- a/app/app/services/cbv_invitation_service.rb
+++ b/app/app/services/cbv_invitation_service.rb
@@ -34,7 +34,7 @@ def track_event(cbv_flow_invitation, current_user)
timestamp: Time.now.to_i,
user_id: current_user.id,
caseworker_email_address: current_user.email,
- site_id: cbv_flow_invitation.site_id,
+ client_agency_id: cbv_flow_invitation.client_agency_id,
invitation_id: cbv_flow_invitation.id
})
end
diff --git a/app/app/services/pinwheel_webhook_manager.rb b/app/app/services/pinwheel_webhook_manager.rb
index 7a651b6a5..e2827f342 100644
--- a/app/app/services/pinwheel_webhook_manager.rb
+++ b/app/app/services/pinwheel_webhook_manager.rb
@@ -17,7 +17,7 @@ class PinwheelWebhookManager
]
def initialize
- @sandbox_config = Rails.application.config.sites["sandbox"]
+ @sandbox_config = Rails.application.config.client_agencies["sandbox"]
@pinwheel = PinwheelService.new(@sandbox_config.pinwheel_environment)
end
diff --git a/app/app/views/applicant_mailer/invitation_email.html.erb b/app/app/views/applicant_mailer/invitation_email.html.erb
index 1ceeae3f5..56fc15474 100644
--- a/app/app/views/applicant_mailer/invitation_email.html.erb
+++ b/app/app/views/applicant_mailer/invitation_email.html.erb
@@ -5,25 +5,25 @@
<%= t("shared.pilot_name") %> |
- <% if current_site.id == "ma" %>
+ <% if current_agency.id == "ma" %>
<%= image_tag "dta_logo.png", class: "text-middle", style: "width: 140px" %>
- <% elsif current_site.id == "nyc" %>
+ <% elsif current_agency.id == "nyc" %>
<%= image_tag "hra_logo.png", class: "text-middle", style: "width: 170px" %>
<% else %>
- <%= site_translation("shared.header.cbv_flow_title") %>
+ <%= agency_translation("shared.header.cbv_flow_title") %>
<% end %>
- <%= site_translation(".header") %>
+ <%= agency_translation(".header") %>
<%= t(".greeting") %>
-
<%= site_translation(".body_1", agency_acronym: current_site.agency_short_name) %>
-
<%= site_translation(".body_2_html", deadline: format_date(@cbv_flow_invitation.expires_at.to_s)) %>
-
<%= site_translation(".body_3", app_name: site_translation("shared.app_name")) %>
+
<%= agency_translation(".body_1", agency_acronym: current_agency.agency_short_name) %>
+
<%= agency_translation(".body_2_html", deadline: format_date(@cbv_flow_invitation.expires_at.to_s)) %>
+
<%= agency_translation(".body_3", app_name: agency_translation("shared.app_name")) %>
<%= t(".button_caption") %>
diff --git a/app/app/views/applicant_mailer/invitation_reminder_email.html.erb b/app/app/views/applicant_mailer/invitation_reminder_email.html.erb
index 29b4ca58c..447516536 100644
--- a/app/app/views/applicant_mailer/invitation_reminder_email.html.erb
+++ b/app/app/views/applicant_mailer/invitation_reminder_email.html.erb
@@ -5,12 +5,12 @@
<%= t("shared.pilot_name") %> |
- <% if current_site?(:ma) %>
+ <% if current_agency?(:ma) %>
<%= image_tag "dta_logo.png", class: "text-middle", style: "width: 140px" %>
- <% elsif current_site.id == "nyc" %>
+ <% elsif current_agency.id == "nyc" %>
<%= image_tag "hra_logo.png", class: "text-middle", style: "width: 170px" %>
<% else %>
- <%= site_translation("shared.header.cbv_flow_title") %>
+ <%= agency_translation("shared.header.cbv_flow_title") %>
<% end %>
@@ -18,14 +18,14 @@
<%= t(".greeting") %>
-
<%= site_translation(".main_action_html", deadline: format_date(@cbv_flow_invitation.expires_at.to_s)) %>
+
<%= agency_translation(".main_action_html", deadline: format_date(@cbv_flow_invitation.expires_at.to_s)) %>
<%= t(".verify_income_button") %>
-
<%= t(".instructions", agency_acronym: current_site.agency_short_name) %>
+
<%= t(".instructions", agency_acronym: current_agency.agency_short_name) %>
<%= t(".feedback_header") %>
@@ -37,7 +37,7 @@
- <%= t(".footer", agency_acronym: current_site.agency_short_name) %>
+ <%= t(".footer", agency_acronym: current_agency.agency_short_name) %>
diff --git a/app/app/views/application/_header.html.erb b/app/app/views/application/_header.html.erb
index 6985369a6..dd348ae6a 100644
--- a/app/app/views/application/_header.html.erb
+++ b/app/app/views/application/_header.html.erb
@@ -1,8 +1,8 @@
-<% if current_site.present? %>
+<% if current_agency.present? %>
<% end %>
@@ -13,22 +13,22 @@
@@ -44,7 +44,7 @@
<% if user_signed_in? %>
-
- <%= button_to t("shared.header.log_out"), destroy_user_session_url(site_id: current_user.site_id), method: :delete, class: "usa-nav__link" %>
+ <%= button_to t("shared.header.log_out"), destroy_user_session_url(client_agency_id: current_user.client_agency_id), method: :delete, class: "usa-nav__link" %>
<% end %>
diff --git a/app/app/views/caseworker/cbv_flow_invitations/new.html.erb b/app/app/views/caseworker/cbv_flow_invitations/new.html.erb
index 4be06f61b..cbdc9adde 100644
--- a/app/app/views/caseworker/cbv_flow_invitations/new.html.erb
+++ b/app/app/views/caseworker/cbv_flow_invitations/new.html.erb
@@ -2,9 +2,9 @@
<%= t(".header") %>
- <%= site_translation(".description_html", pay_income_days: current_site.pay_income_days) %>
+ <%= agency_translation(".description_html", pay_income_days: current_agency.pay_income_days) %>
<%= uswds_form_with(model: @cbv_flow_invitation, url: invitations_path) do |f| %>
- <%= render partial: "caseworker/cbv_flow_invitations/#{@cbv_flow_invitation.site_id}", locals: { f: f } %>
+ <%= render partial: "caseworker/cbv_flow_invitations/#{@cbv_flow_invitation.client_agency_id}", locals: { f: f } %>
<%= f.submit t(".form.submit") %>
<% end %>
diff --git a/app/app/views/caseworker/dashboards/show.html.erb b/app/app/views/caseworker/dashboards/show.html.erb
index b601d5333..4d4a5ab8b 100644
--- a/app/app/views/caseworker/dashboards/show.html.erb
+++ b/app/app/views/caseworker/dashboards/show.html.erb
@@ -10,12 +10,12 @@
- <%= t(".reminder_1") %>
- - <%= t(".reminder_2", expires_days: t(".expires_within", count: current_site.invitation_valid_days)) %>
+ - <%= t(".reminder_2", expires_days: t(".expires_within", count: current_agency.invitation_valid_days)) %>
- <%= t(".reminder_3") %>
- <%= t(".reminder_4") %>
- <%= link_to t(".create_invitation"), new_invitation_path(site_id: params[:site_id]), class: "usa-button usa-button--primary" %>
+ <%= link_to t(".create_invitation"), new_invitation_path(client_agency_id: params[:client_agency_id]), class: "usa-button usa-button--primary" %>
diff --git a/app/app/views/caseworker/entries/_ma_dta_signin_button.html.erb b/app/app/views/caseworker/entries/_ma_dta_signin_button.html.erb
index cb560b233..c229da9a8 100644
--- a/app/app/views/caseworker/entries/_ma_dta_signin_button.html.erb
+++ b/app/app/views/caseworker/entries/_ma_dta_signin_button.html.erb
@@ -1 +1 @@
-<%= button_to site_translation("caseworker.entries.index.continue_to_login"), user_ma_dta_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
+<%= button_to agency_translation("caseworker.entries.index.continue_to_login"), user_ma_dta_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
diff --git a/app/app/views/caseworker/entries/_nyc_dss_signin_button.html.erb b/app/app/views/caseworker/entries/_nyc_dss_signin_button.html.erb
index 7568e9e23..4ebe30338 100644
--- a/app/app/views/caseworker/entries/_nyc_dss_signin_button.html.erb
+++ b/app/app/views/caseworker/entries/_nyc_dss_signin_button.html.erb
@@ -1 +1 @@
-<%= button_to site_translation("caseworker.entries.index.continue_to_login"), user_nyc_dss_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
+<%= button_to agency_translation("caseworker.entries.index.continue_to_login"), user_nyc_dss_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
diff --git a/app/app/views/caseworker/entries/_sandbox_signin_button.html.erb b/app/app/views/caseworker/entries/_sandbox_signin_button.html.erb
index 4a8b04240..4e317d3e3 100644
--- a/app/app/views/caseworker/entries/_sandbox_signin_button.html.erb
+++ b/app/app/views/caseworker/entries/_sandbox_signin_button.html.erb
@@ -1 +1 @@
-<%= button_to site_translation("caseworker.entries.index.continue_to_login"), user_sandbox_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
+<%= button_to agency_translation("caseworker.entries.index.continue_to_login"), user_sandbox_omniauth_authorize_path, data: { turbo: false }, class: "usa-button" %>
diff --git a/app/app/views/caseworker/entries/index.html.erb b/app/app/views/caseworker/entries/index.html.erb
index d4cc2fe12..62af8efee 100644
--- a/app/app/views/caseworker/entries/index.html.erb
+++ b/app/app/views/caseworker/entries/index.html.erb
@@ -1,17 +1,17 @@
-<% header_text = site_translation(".header") %>
+<% header_text = agency_translation(".header") %>
<% content_for :title, header_text %>
<%= header_text %>
-
<%= site_translation(".description") %>
+
<%= agency_translation(".description") %>
<%= t(".how_it_works") %>
-
-
<%= site_translation(".step_1_title") %>
+ <%= agency_translation(".step_1_title") %>
<%= t(".step_1_description") %>
-
@@ -28,4 +28,4 @@
-<%= render partial: "#{current_site.sso['name']}_signin_button" %>
+<%= render partial: "#{current_agency.sso['name']}_signin_button" %>
diff --git a/app/app/views/caseworker_mailer/summary_email.html.erb b/app/app/views/caseworker_mailer/summary_email.html.erb
index 70f8bd8d3..ecb15e96a 100644
--- a/app/app/views/caseworker_mailer/summary_email.html.erb
+++ b/app/app/views/caseworker_mailer/summary_email.html.erb
@@ -4,7 +4,7 @@
Attached is an Income Verification Report PDF with confirmation number <%= @cbv_flow.confirmation_code %>.
This confirmation number has been shared with the client and is used to confirm that their information has been
- submitted to <%= current_site.agency_short_name %>.
+ submitted to <%= current_agency.agency_short_name %>.
diff --git a/app/app/views/cbv/add_jobs/show.html.erb b/app/app/views/cbv/add_jobs/show.html.erb
index c65b96dd2..0bcc81025 100644
--- a/app/app/views/cbv/add_jobs/show.html.erb
+++ b/app/app/views/cbv/add_jobs/show.html.erb
@@ -1,39 +1,39 @@
<% content_for :title, t(".header") %>
<%= t(".header") %>
-<%= t(".subheader", pay_income_days: current_site.pay_income_days) %>
+<%= t(".subheader", pay_income_days: current_agency.pay_income_days) %>
<%= t(".answer_yes_header_html") %>
-
-
- - <%= t(".answer_yes_bullet_1") %>
- - <%= t(".answer_yes_bullet_2") %>
- - <%= t(".answer_yes_bullet_3") %>
-
+
+
+ - <%= t(".answer_yes_bullet_1") %>
+ - <%= t(".answer_yes_bullet_2") %>
+ - <%= t(".answer_yes_bullet_3") %>
+
<%= t(".answer_no_header") %>
-
- - <%= t(".answer_no_bullet_1") %>
- - <%= t(".answer_no_bullet_2") %>
- - <%= t(".answer_no_bullet_3") %>
- - <%= t(".answer_no_bullet_4") %>
- - <%= t(".answer_no_bullet_5") %>
-
+
+ - <%= t(".answer_no_bullet_1") %>
+ - <%= t(".answer_no_bullet_2") %>
+ - <%= t(".answer_no_bullet_3") %>
+ - <%= t(".answer_no_bullet_4") %>
+ - <%= t(".answer_no_bullet_5") %>
+
- <%= t(".criteria_disclaimer", pay_income_days: current_site.pay_income_days) %>
- <%= site_translation(".learn_more_link_html") %>
+ <%= t(".criteria_disclaimer", pay_income_days: current_agency.pay_income_days) %>
+ <%= agency_translation(".learn_more_link_html") %>
-
+
<%= form_with(url: cbv_flow_add_job_path, builder: UswdsFormBuilder, data: { "add-job-target": "addJobForm", turbo: "false" }, id: "add_job_form") do |f| %>
<%= f.radio_button(:additional_jobs, true, { label: t(".yes_radio") }) %>
<%= f.radio_button(:additional_jobs, false, { label: t(".no_radio") }) %>
<%= f.submit t(".continue") %>
-
- <% end %>
+
+<% end %>
diff --git a/app/app/views/cbv/employer_searches/_employer.html.erb b/app/app/views/cbv/employer_searches/_employer.html.erb
index 7a2fd0823..f21d5b7d1 100644
--- a/app/app/views/cbv/employer_searches/_employer.html.erb
+++ b/app/app/views/cbv/employer_searches/_employer.html.erb
@@ -54,7 +54,7 @@
<%= t("cbv.employer_searches.show.to_continue") %>
- - <%= t("cbv.employer_searches.show.to_continue_li_1") %> <%= site_translation("cbv.employer_searches.show.to_continue_li_1_html") %>
+ - <%= t("cbv.employer_searches.show.to_continue_li_1") %> <%= agency_translation("cbv.employer_searches.show.to_continue_li_1_html") %>
- <%= t("cbv.employer_searches.show.to_continue_li_2") %>
<% if @has_pinwheel_account %>
- <%= t("cbv.employer_searches.show.to_continue_li_3_continue") %>
@@ -64,11 +64,11 @@
- <% if @has_pinwheel_account %>
- <%= link_to t("cbv.employer_searches.show.review_button_text"), cbv_flow_summary_path, class: "usa-button usa-button--outline margin-top-5", data: { turbo_frame: "_top" } %>
- <% else %>
- <%= link_to t("cbv.employer_searches.show.exit_button_text", agency_short_name: current_site.agency_short_name), current_site.agency_contact_website, class: "usa-button usa-button--outline margin-top-5", data: { turbo_frame: "_top" } %>
- <% end %>
+ <% if @has_pinwheel_account %>
+ <%= link_to t("cbv.employer_searches.show.review_button_text"), cbv_flow_summary_path, class: "usa-button usa-button--outline margin-top-5", data: { turbo_frame: "_top" } %>
+ <% else %>
+ <%= link_to t("cbv.employer_searches.show.exit_button_text", agency_short_name: current_agency.agency_short_name), current_agency.agency_contact_website, class: "usa-button usa-button--outline margin-top-5", data: { turbo_frame: "_top" } %>
+ <% end %>
<% elsif @employers.count > 0 %>
diff --git a/app/app/views/cbv/entries/show.html.erb b/app/app/views/cbv/entries/show.html.erb
index b4b6c462b..c36d9c467 100644
--- a/app/app/views/cbv/entries/show.html.erb
+++ b/app/app/views/cbv/entries/show.html.erb
@@ -3,7 +3,7 @@
<%= title %>
-
<%= t(".subheader_html", agency_acronym: current_site.agency_short_name) %>
+
<%= t(".subheader_html", agency_acronym: current_agency.agency_short_name) %>
@@ -13,15 +13,15 @@
-
<%= t(".step2") %>
- <%= t(".step2_description", agency_acronym: current_site.agency_short_name) %>
+ <%= t(".step2_description", agency_acronym: current_agency.agency_short_name) %>
-
<%= t(".step3") %>
- <%= t(".step3_description", agency_acronym: current_site.agency_short_name) %>
+ <%= t(".step3_description", agency_acronym: current_agency.agency_short_name) %>
<%= form_with(url: cbv_flow_entry_path, builder: UswdsFormBuilder, data: { turbo: "false" }) do |f| %>
- <%= f.check_box(:agreement, label: site_translation(".checkbox", agency_full_name: site_translation("shared.agency_full_name"))) %>
+ <%= f.check_box(:agreement, label: agency_translation(".checkbox", agency_full_name: agency_translation("shared.agency_full_name"))) %>
<%= f.submit t(".continue") %>
<% end %>
diff --git a/app/app/views/cbv/expired_invitations/show.html.erb b/app/app/views/cbv/expired_invitations/show.html.erb
index 311175b77..85b54cb78 100644
--- a/app/app/views/cbv/expired_invitations/show.html.erb
+++ b/app/app/views/cbv/expired_invitations/show.html.erb
@@ -1,11 +1,12 @@
<% content_for :title, t(".title") %>
+
<%= t(".title") %>
<%= t(".body_1") %>
-
<%= t(".body_2", agency_short_name: current_site.agency_short_name) %>
+
<%= t(".body_2", agency_short_name: current_agency.agency_short_name) %>
- <%= site_translation(".cta_button_html") %>
+ <%= agency_translation(".cta_button_html") %>
diff --git a/app/app/views/cbv/missing_results/show.html.erb b/app/app/views/cbv/missing_results/show.html.erb
index fe0e286b1..c49e10257 100644
--- a/app/app/views/cbv/missing_results/show.html.erb
+++ b/app/app/views/cbv/missing_results/show.html.erb
@@ -2,22 +2,22 @@
<%= t(".header") %>
-
<%= t(".not_listed_p1", agency_acronym: current_site.agency_short_name) %>
+
<%= t(".not_listed_p1", agency_acronym: current_agency.agency_short_name) %>
- <% if current_site.id == "ma" %>
+ <% if current_agency.id == "ma" %>
<%= t(".dta_options_header") %>
-
- - <%= t(".dta_options_1_html") %>
- - <%= t(".dta_options_2_html") %>
- - <%= t(".dta_options_3_html") %>
- - <%= t(".dta_options_4_html") %>
- - <%= t(".dta_options_5_html") %>
-
+
+ - <%= t(".dta_options_1_html") %>
+ - <%= t(".dta_options_2_html") %>
+ - <%= t(".dta_options_3_html") %>
+ - <%= t(".dta_options_4_html") %>
+ - <%= t(".dta_options_5_html") %>
+
<% else %>
-
<%= t(".not_listed_p2", agency_short_name: current_site.agency_short_name) %>
- <% end %>
+
<%= t(".not_listed_p2", agency_short_name: current_agency.agency_short_name) %>
+<% end %>
<% unless @has_pinwheel_account %>
- <%= site_translation(".exit_button_html") %>
+ <%= agency_translation(".exit_button_html") %>
<% end %>
@@ -25,7 +25,7 @@
<%= t(".no_more_jobs") %>
-
<%= t(".continue_to_review", agency_acronym: current_site.agency_short_name) %>
+
<%= t(".continue_to_review", agency_acronym: current_agency.agency_short_name) %>
<%= link_to t(".continue_button"), next_path, class: "usa-button" %>
<% end %>
diff --git a/app/app/views/cbv/payment_details/show.html.erb b/app/app/views/cbv/payment_details/show.html.erb
index 052bedb18..aff3ac644 100644
--- a/app/app/views/cbv/payment_details/show.html.erb
+++ b/app/app/views/cbv/payment_details/show.html.erb
@@ -5,7 +5,7 @@
-
<%= t(".subheader", start_date: @payments_beginning_at, end_date: @payments_ending_at, agency_acronym: current_site.agency_short_name) %>
+
<%= t(".subheader", start_date: @payments_beginning_at, end_date: @payments_ending_at, agency_acronym: current_agency.agency_short_name) %>
<% if @payments.any? %>
@@ -70,7 +70,7 @@
<%= t(".additional_information_header") %>
<%= form_with(model: @cbv_flow, url: cbv_flow_payment_details_path, method: :patch) do |form| %>
<%= hidden_field_tag "user[account_id]", params[:user][:account_id] %>
- <%= form.label :additional_information, t(".additional_information_label", agency_acronym: current_site.agency_short_name), class: "usa-label" %>
+ <%= form.label :additional_information, t(".additional_information_label", agency_acronym: current_agency.agency_short_name), class: "usa-label" %>
<%= form.text_area :additional_information, class: "usa-textarea", rows: 5, value: @account_comment %>
<%= form.submit t(".continue"), class: "usa-button usa-button--primary margin-top-3" %>
<% end %>
diff --git a/app/app/views/cbv/successes/show.html.erb b/app/app/views/cbv/successes/show.html.erb
index d4bdbd634..4297850b0 100644
--- a/app/app/views/cbv/successes/show.html.erb
+++ b/app/app/views/cbv/successes/show.html.erb
@@ -1,25 +1,24 @@
-<% title = t(".header", agency_acronym: current_site.agency_short_name) %>
+<% title = t(".header", agency_acronym: current_agency.agency_short_name) %>
<% content_for :title, title %>
-
<%= title %>
+<%= title %>
-
- <%= t(".confirmation_code_html", confirmation_code: @cbv_flow.confirmation_code) %>
-
+
<%= t(".confirmation_code_html", confirmation_code: @cbv_flow.confirmation_code) %>
-
<%= t(".caseworker_received", agency_acronym: current_site.agency_short_name) %>
-
<%= t(".if_it_didnt_work", agency_acronym: current_site.agency_short_name) %>
-
<%= site_translation(".check_status") %>
-
+
<%= t(".caseworker_received", agency_acronym: current_agency.agency_short_name) %>
+
<%= t(".if_it_didnt_work", agency_acronym: current_agency.agency_short_name) %>
+
+
<%= agency_translation(".check_status") %>
<%= link_to cbv_flow_summary_path(format: "pdf"), target: "_blank", rel: "noopener noreferrer", class: "usa-button margin-top-3 usa-button--primary" do %>
<%= t(".download") %>
-<% end %>
+ <% end %>
<%= link_to agency_url, target: "_blank", rel: "noopener noreferrer", class: "usa-button margin-top-3 usa-button usa-button--outline" do %>
- <%= t(".back_to_agency", agency_short_name: current_site.agency_short_name) %>
+ <%= t(".back_to_agency", agency_short_name: current_agency.agency_short_name) %>
<% end %>
+
diff --git a/app/app/views/cbv/summaries/show.html.erb b/app/app/views/cbv/summaries/show.html.erb
index 7a73dcf5c..9318c37c7 100644
--- a/app/app/views/cbv/summaries/show.html.erb
+++ b/app/app/views/cbv/summaries/show.html.erb
@@ -5,7 +5,7 @@
- <%= t(".description", start_date: @payments_beginning_at, end_date: @payments_ending_at, agency_acronym: current_site.agency_short_name) %>
+ <%= t(".description", start_date: @payments_beginning_at, end_date: @payments_ending_at, agency_acronym: current_agency.agency_short_name) %>
@@ -25,7 +25,7 @@
<% end %>
-
+
<% if summary[:total] > 0 %>
@@ -39,24 +39,24 @@
<% end %>
|
-
+
-
+
<% summary[:payments].each do |payment| %>
-
+
<%= t(".payment", amount: format_money(payment.gross_pay_amount), date: format_date(payment.pay_date)) %> |
-
- <% end %>
-
-
+
+ <% end %>
+
+
<%= t(".additional_comments") %>
<%= get_comment_by_account_id(account_id).dig("comment") != "" ? get_comment_by_account_id(account_id).dig("comment") : t("shared.not_applicable") %>
-<% end %>
+ <% end %>
<%= form_with model: @cbv_flow, url: cbv_flow_summary_path, html: { class: "usa-form maxw-full" }, builder: UswdsFormBuilder, method: "patch" do |f| %>
<% unless has_consent %>
-<%= t(".consent_to_authorize_use_title") %>
-<%= f.check_box(:consent_to_authorized_use, { 'label': site_translation(".consent_to_authorize_use_html") }) %>
+ <%= t(".consent_to_authorize_use_title") %>
+<%= f.check_box(:consent_to_authorized_use, { 'label': agency_translation(".consent_to_authorize_use_html") }) %>
<% end %>
- <%= f.submit t(".send_report", agency_acronym: current_site.agency_short_name), class: "margin-top-5" %>
+ <%= f.submit t(".send_report", agency_acronym: current_agency.agency_short_name), class: "margin-top-5" %>
<% end %>
diff --git a/app/app/views/cbv/summaries/show.pdf.erb b/app/app/views/cbv/summaries/show.pdf.erb
index 216a84a85..063f6594e 100644
--- a/app/app/views/cbv/summaries/show.pdf.erb
+++ b/app/app/views/cbv/summaries/show.pdf.erb
@@ -1,16 +1,16 @@
- <% if current_site?(:ma) %>
- <%= image_tag wicked_pdf_asset_base64(current_site.logo_square_path), class: "text-middle cbv-header__agency-logo cbv-header__agency-logo--#{current_site.id}" %>
- <% elsif current_site?(:nyc) %>
- <%= image_tag wicked_pdf_asset_base64(current_site.logo_square_path), class: "text-middle cbv-header__agency-logo cbv-header__agency-logo--#{current_site.id}" %>
+ <% if current_agency?(:ma) %>
+ <%= image_tag wicked_pdf_asset_base64(current_agency.logo_square_path), class: "text-middle cbv-header__agency-logo cbv-header__agency-logo--#{current_agency.id}" %>
+ <% elsif current_agency?(:nyc) %>
+ <%= image_tag wicked_pdf_asset_base64(current_agency.logo_square_path), class: "text-middle cbv-header__agency-logo cbv-header__agency-logo--#{current_agency.id}" %>
<% end %>
- <% if current_site %>
+ <% if current_agency %>
<% end %>
- <%= site_translation(".pdf.agency_header_name") %>
+ <%= agency_translation(".pdf.agency_header_name") %>
<%= t(".pdf.client.header") %>
@@ -26,7 +26,7 @@
<% else %>
- <%= t(".pdf.client.description", agency_acronym: current_site.agency_short_name) %>
+ <%= t(".pdf.client.description", agency_acronym: current_agency.agency_short_name) %>
<% end %>
<%= t(".pdf.client.client_report_information") %>
@@ -35,7 +35,7 @@
<%= table.with_header do %>
<%= t(".pdf.shared.client_information") %>
<% end %>
- <% if current_site?(:ma) && !is_caseworker %>
+ <% if current_agency?(:ma) && !is_caseworker %>
<%= table.with_row(t(".pdf.client.agency_id_number"), @cbv_flow.cbv_flow_invitation.agency_id_number) %>
<% end %>
<% if is_caseworker %>
@@ -43,12 +43,12 @@
<%= table.with_row(t(".pdf.caseworker.middle_name"), @cbv_flow.cbv_flow_invitation.middle_name) %>
<%= table.with_row(t(".pdf.caseworker.last_name"), @cbv_flow.cbv_flow_invitation.last_name) %>
- <% if current_site?(:nyc) %>
+ <% if current_agency?(:nyc) %>
<%= table.with_row(t(".pdf.caseworker.client_id_number"), @cbv_flow.cbv_flow_invitation.client_id_number) %>
<%= table.with_row(t(".pdf.caseworker.case_number"), @cbv_flow.cbv_flow_invitation.case_number) %>
<% end %>
- <% if current_site?(:ma) %>
+ <% if current_agency?(:ma) %>
<%= table.with_row(t(".pdf.caseworker.client_email_address"), @cbv_flow.cbv_flow_invitation.email_address) %>
<%= table.with_row(t(".pdf.caseworker.snap_agency_id"), @cbv_flow.cbv_flow_invitation.agency_id_number) %>
<% end %>
@@ -62,12 +62,12 @@
<% if @cbv_flow.confirmation_code.present? %>
<%= table.with_row(t(".pdf.shared.confirmation_code"), @cbv_flow.confirmation_code) %>
<% end %>
- <%= table.with_row(site_translation(".application_or_recertification_date"), format_parsed_date(@cbv_flow.cbv_flow_invitation.snap_application_date)) %>
+ <%= table.with_row(agency_translation(".application_or_recertification_date"), format_parsed_date(@cbv_flow.cbv_flow_invitation.snap_application_date)) %>
<%= table.with_row(t(".pdf.client.date_created"), format_parsed_date(@cbv_flow.consented_to_authorized_use_at)) %>
<%= table.with_row(t(".pdf.client.date_range"), "#{format_parsed_date(@cbv_flow.cbv_flow_invitation.paystubs_query_begins_at)} to #{format_parsed_date(@cbv_flow.cbv_flow_invitation.snap_application_date)}") %>
<% if is_caseworker %>
<%= table.with_row(t(".pdf.caseworker.agreement_consent_timestamp"), @cbv_flow.consented_to_authorized_use_at) %>
- <% if current_site?(:ma) %>
+ <% if current_agency?(:ma) %>
<%= table.with_row(t(".pdf.caseworker.staff_beacon_id_wel_id"), @cbv_flow.cbv_flow_invitation.beacon_id) %>
<% end %>
<% end %>
diff --git a/app/app/views/cbv/synchronization_failures/show.html.erb b/app/app/views/cbv/synchronization_failures/show.html.erb
index c017fdeaa..670940450 100644
--- a/app/app/views/cbv/synchronization_failures/show.html.erb
+++ b/app/app/views/cbv/synchronization_failures/show.html.erb
@@ -8,11 +8,11 @@
- <%= t(".option_1") %>
- <%= t(".option_2") %>
- - <%= t(".option_3", agency_acronym: current_site.agency_short_name) %>
+ - <%= t(".option_3", agency_acronym: current_agency.agency_short_name) %>
<% if @cbv_flow.has_account_with_required_data? %>
- - <%= t("cbv.missing_results.show.continue_to_review", agency_acronym: current_site.agency_short_name) %>
+ - <%= t("cbv.missing_results.show.continue_to_review", agency_acronym: current_agency.agency_short_name) %>
<% end %>
-
+
diff --git a/app/app/views/help/index.html.erb b/app/app/views/help/index.html.erb
index f9c4981e8..a15cbfba7 100644
--- a/app/app/views/help/index.html.erb
+++ b/app/app/views/help/index.html.erb
@@ -10,7 +10,7 @@
<%= render "help_topic_link", topic: "provider", text: t("help.index.provider") %>
<%= render "help_topic_link", topic: "credentials", text: t("help.index.credentials") %>
- <% if current_site && current_site.caseworker_feedback_form.present? %>
+ <% if current_agency && current_agency.caseworker_feedback_form.present? %>
<%= link_to feedback_form_url, class: "usa-button margin-bottom-1 height-5 text-left display-block", target: "_blank" do %>
<%= t("help.index.feedback") %>
<% end %>
diff --git a/app/config/application.rb b/app/config/application.rb
index 518bd1c68..c1af76417 100644
--- a/app/config/application.rb
+++ b/app/config/application.rb
@@ -13,7 +13,7 @@
require "action_view/railtie"
require "action_cable/engine"
# require "rails/test_unit/railtie"
-require_relative "../lib/site_config.rb"
+require_relative "../lib/client_agency_config.rb"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -40,7 +40,7 @@ class Application < Rails::Application
config.autoload_paths += %W[#{config.root}/lib]
config.autoload_paths += %W[#{config.root}/app/helpers]
config.autoload_paths += %W[#{config.root}/app/controllers/concerns]
- config.sites = SiteConfig.new(Rails.root.join("config", "site-config.yml"))
+ config.client_agencies = ClientAgencyConfig.new(Rails.root.join("config", "client-agency-config.yml"))
# See: https://guides.rubyonrails.org/active_record_encryption.html#setup
config.active_record.encryption.primary_key = ENV["ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY"]
diff --git a/app/config/site-config.yml b/app/config/client-agency-config.yml
similarity index 100%
rename from app/config/site-config.yml
rename to app/config/client-agency-config.yml
diff --git a/app/config/initializers/devise.rb b/app/config/initializers/devise.rb
index 93adabf2a..9b9fc14d0 100644
--- a/app/config/initializers/devise.rb
+++ b/app/config/initializers/devise.rb
@@ -281,7 +281,7 @@
config.omniauth(
:ma_dta,
{
- **Rails.application.config.sites["ma"].sso,
+ **Rails.application.config.client_agencies["ma"].sso,
strategy_class: OmniAuth::Strategies::AzureActivedirectoryV2,
pkce: true
}
@@ -290,7 +290,7 @@
config.omniauth(
:nyc_dss,
{
- **Rails.application.config.sites["nyc"].sso,
+ **Rails.application.config.client_agencies["nyc"].sso,
strategy_class: OmniAuth::Strategies::AzureActivedirectoryV2,
pkce: true
}
@@ -299,7 +299,7 @@
config.omniauth(
:sandbox,
{
- **Rails.application.config.sites["sandbox"].sso,
+ **Rails.application.config.client_agencies["sandbox"].sso,
strategy_class: OmniAuth::Strategies::AzureActivedirectoryV2,
pkce: true
}
diff --git a/app/config/locales/en.yml b/app/config/locales/en.yml
index 7cc158287..94ff67308 100644
--- a/app/config/locales/en.yml
+++ b/app/config/locales/en.yml
@@ -71,7 +71,7 @@ en:
create:
invite_failed: 'Error sending invitation to %{email_address}: %{error_message}.'
invite_success: Successfully delivered invitation to %{email_address}.
- incorrect_site_id: Unable to send invitation due to missing site configuration.
+ incorrect_client_agency_id: Unable to send invitation due to missing client agency configuration.
ma:
invite:
agency_id_number: Client's agency ID number
diff --git a/app/config/locales/es.yml b/app/config/locales/es.yml
index c95391d7c..ba7fd041c 100644
--- a/app/config/locales/es.yml
+++ b/app/config/locales/es.yml
@@ -44,7 +44,7 @@ es:
create:
invite_failed: 'Error al enviar la invitació a %{email_address}: %{error_message}'
invite_success: La invitación ha sido enviada con éxito a %{email_address}.
- incorrect_site_id: No se ha podido enviar la invitación porque falta la configuración del sitio.
+ incorrect_client_agency_id: No se ha podido enviar la invitación porque falta la configuración del sitio.
cbv:
add_jobs:
create:
diff --git a/app/config/routes.rb b/app/config/routes.rb
index b0a836ebf..244a9ef11 100644
--- a/app/config/routes.rb
+++ b/app/config/routes.rb
@@ -42,8 +42,8 @@
resource :reset, only: %i[show]
end
- scope "/:site_id", module: :caseworker, constraints: { site_id: Regexp.union(Rails.application.config.sites.site_ids) } do
- get "/sso", to: redirect("/%{site_id}") # Temporary: Remove once people get used to going to /:site_id as the login destination.
+ scope "/:client_agency_id", module: :caseworker, constraints: { client_agency_id: Regexp.union(Rails.application.config.client_agencies.client_agency_ids) } do
+ get "/sso", to: redirect("/%{client_agency_id}") # Temporary: Remove once people get used to going to /:client_agency_id as the login destination.
root to: "entries#index", as: :new_user_session
resource :dashboard, only: %i[show], as: :caseworker_dashboard
diff --git a/app/db/migrate/20250205215840_rename_site_id_to_client_agency_id.rb b/app/db/migrate/20250205215840_rename_site_id_to_client_agency_id.rb
new file mode 100644
index 000000000..b1e41c006
--- /dev/null
+++ b/app/db/migrate/20250205215840_rename_site_id_to_client_agency_id.rb
@@ -0,0 +1,12 @@
+class RenameSiteIdToClientAgencyId < ActiveRecord::Migration[7.0]
+ def change
+ # First rename the columns
+ rename_column :cbv_flows, :site_id, :client_agency_id
+ rename_column :users, :site_id, :client_agency_id
+ rename_column :cbv_flow_invitations, :site_id, :client_agency_id
+
+ # Then handle the index - Rails will automatically handle the reversal
+ remove_index :users, [ :email, :site_id ] if index_exists?(:users, [ :email, :site_id ])
+ add_index :users, [ :email, :client_agency_id ], unique: true unless index_exists?(:users, [ :email, :client_agency_id ])
+ end
+end
diff --git a/app/db/schema.rb b/app/db/schema.rb
index 4927973dc..b1032951e 100644
--- a/app/db/schema.rb
+++ b/app/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.1].define(version: 2025_01_31_205655) do
+ActiveRecord::Schema[7.1].define(version: 2025_02_05_215840) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@@ -43,7 +43,7 @@
t.string "auth_token"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.string "site_id"
+ t.string "client_agency_id"
t.string "first_name", null: false
t.string "middle_name"
t.string "last_name", null: false
@@ -69,11 +69,11 @@
t.string "pinwheel_token_id"
t.uuid "pinwheel_end_user_id", default: -> { "gen_random_uuid()" }, null: false
t.jsonb "additional_information", default: {}
- t.string "site_id"
+ t.string "client_agency_id"
t.string "confirmation_code"
t.datetime "transmitted_at"
- t.datetime "consented_to_authorized_use_at"
t.datetime "redacted_at"
+ t.datetime "consented_to_authorized_use_at"
t.bigint "cbv_client_id"
t.index ["cbv_client_id"], name: "index_cbv_flows_on_cbv_client_id"
t.index ["cbv_flow_invitation_id"], name: "index_cbv_flows_on_cbv_flow_invitation_id"
@@ -97,7 +97,7 @@
end
create_table "users", force: :cascade do |t|
- t.string "site_id", null: false
+ t.string "client_agency_id", null: false
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
@@ -112,7 +112,7 @@
t.datetime "updated_at", null: false
t.jsonb "invalidated_session_ids"
t.boolean "is_service_account", default: false
- t.index ["email", "site_id"], name: "index_users_on_email_and_site_id", unique: true
+ t.index ["email", "client_agency_id"], name: "index_users_on_email_and_client_agency_id", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
diff --git a/app/lib/site_config.rb b/app/lib/client_agency_config.rb
similarity index 74%
rename from app/lib/site_config.rb
rename to app/lib/client_agency_config.rb
index 2677af4d3..1c02d6533 100644
--- a/app/lib/site_config.rb
+++ b/app/lib/client_agency_config.rb
@@ -1,23 +1,23 @@
require "yaml"
-class SiteConfig
+class ClientAgencyConfig
def initialize(config_path)
template = ERB.new File.read(config_path)
- @sites = YAML
+ @client_agencies = YAML
.safe_load(template.result(binding))
- .map { |s| [ s["id"], Site.new(s) ] }
+ .map { |s| [ s["id"], ClientAgency.new(s) ] }
.to_h
end
- def site_ids
- @sites.keys
+ def client_agency_ids
+ @client_agencies.keys
end
- def [](site_id)
- @sites[site_id]
+ def [](client_agency_id)
+ @client_agencies[client_agency_id]
end
- class Site
+ class ClientAgency
attr_reader(*%i[
id
agency_name
@@ -56,9 +56,9 @@ def initialize(yaml)
@sso = yaml["sso"]
@weekly_report = yaml["weekly_report"]
- raise ArgumentError.new("Site missing id") if @id.blank?
- raise ArgumentError.new("Site #{@id} missing required attribute `agency_name`") if @agency_name.blank?
- raise ArgumentError.new("Site #{@id} missing required attribute `pinwheel.environment`") if @pinwheel_environment.blank?
+ raise ArgumentError.new("Client Agency missing id") if @id.blank?
+ raise ArgumentError.new("Client Agency #{@id} missing required attribute `agency_name`") if @agency_name.blank?
+ raise ArgumentError.new("Client Agency #{@id} missing required attribute `pinwheel.environment`") if @pinwheel_environment.blank?
# TODO: Add a validation for the dependent attribute, transmission_method_configuration.email, if transmission_method is present
end
end
diff --git a/app/lib/generic_event_tracker.rb b/app/lib/generic_event_tracker.rb
index d6b2ae374..d6116f969 100644
--- a/app/lib/generic_event_tracker.rb
+++ b/app/lib/generic_event_tracker.rb
@@ -4,12 +4,12 @@ class GenericEventTracker
def self.for_request(request)
defaults = {}
if request.present?
- url_params = request.params.slice("site_id", "locale")
+ url_params = request.params.slice("client_agency_id", "locale")
defaults = {
# Not setting device_id because Mixpanel fixates on that as the distinct_id, which we do not want
ip: request.ip,
cbv_flow_id: request.session[:cbv_flow_id],
- site_id: url_params["site_id"],
+ client_agency_id: url_params["client_agency_id"],
locale: url_params["locale"],
user_agent: request.headers["User-Agent"]
}
diff --git a/app/lib/tasks/weekly_reports.rake b/app/lib/tasks/weekly_reports.rake
index 69e9545ff..f1e563b8b 100644
--- a/app/lib/tasks/weekly_reports.rake
+++ b/app/lib/tasks/weekly_reports.rake
@@ -4,12 +4,12 @@ namespace :weekly_reports do
report_date = Time.now.in_time_zone("America/New_York").beginning_of_week
WeeklyReportMailer
- .with(site_id: "nyc", report_date: report_date.to_date)
+ .with(client_agency_id: "nyc", report_date: report_date.to_date)
.report_email
.deliver_now
WeeklyReportMailer
- .with(site_id: "ma", report_date: report_date.to_date)
+ .with(client_agency_id: "ma", report_date: report_date.to_date)
.report_email
.deliver_now
end
diff --git a/app/spec/controllers/api/invitations_controller_spec.rb b/app/spec/controllers/api/invitations_controller_spec.rb
index 4bee6158c..8a8c64af4 100644
--- a/app/spec/controllers/api/invitations_controller_spec.rb
+++ b/app/spec/controllers/api/invitations_controller_spec.rb
@@ -4,13 +4,13 @@
describe "#create" do
# must be existing user
let(:api_access_token) do
- user = create(:user, :with_access_token, email: "test@test.com", site_id: 'ma', is_service_account: true)
+ user = create(:user, :with_access_token, email: "test@test.com", client_agency_id: 'ma', is_service_account: true)
user.api_access_tokens.first
end
let(:valid_params) do
attributes_for(:cbv_flow_invitation,
- site_id: "ma",
+ client_agency_id: "ma",
beacon_id: "ABC123",
agency_id_number: "7890120"
)
diff --git a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/auth_spec.rb b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/auth_spec.rb
index 3f2fbcad8..511ba912b 100644
--- a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/auth_spec.rb
+++ b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/auth_spec.rb
@@ -1,9 +1,9 @@
require "rails_helper"
-RSpec.describe Caseworker::CbvFlowInvitationsController do
- let(:nyc_user) { create(:user, email: "test@test.com", site_id: 'nyc') }
- let(:ma_user) { create(:user, email: "test@test.com", site_id: 'ma') }
- let(:ma_params) { { site_id: "ma" } }
+RSpec.describe Caseworker::CbvFlowInvitationsController, type: :controller do
+ let(:nyc_user) { create(:user, email: "test@test.com", client_agency_id: 'nyc') }
+ let(:ma_user) { create(:user, email: "test@test.com", client_agency_id: 'ma') }
+ let(:ma_params) { { client_agency_id: "ma" } }
let(:valid_params) do
attributes_for(:cbv_flow_invitation, :nyc)
end
@@ -16,19 +16,19 @@
end
end
- context "with an invalid site id" do
+ context "with an invalid client agency id" do
it "raises a routing error" do
expect {
- get :new, params: valid_params.tap { |p| p[:site_id] = "this-is-not-a-site-id" }
+ get :new, params: valid_params.tap { |p| p[:client_agency_id] = "this-is-not-a-site-id" }
}.to raise_error(ActionController::UrlGenerationError)
expect response.status == 404
end
end
context "with authentication" do
- context "when site_id is nyc" do
+ context "when client_agency_id is nyc" do
before do
- stub_site_config_value("nyc", "staff_portal_enabled", true)
+ stub_client_agency_config_value("nyc", "staff_portal_enabled", true)
sign_in nyc_user
end
@@ -46,11 +46,11 @@
end
end
- context "when site_id is ma" do
- let(:site_id) { "ma" }
+ context "when client_agency_id is ma" do
+ let(:client_agency_id) { "ma" }
before do
- stub_site_config_value("ma", "staff_portal_enabled", true)
+ stub_client_agency_config_value("ma", "staff_portal_enabled", true)
sign_in ma_user
end
@@ -62,7 +62,7 @@
end
it "does not permit access to the nyc page" do
- get :new, params: { site_id: "nyc" }
+ get :new, params: { client_agency_id: "nyc" }
expect(response).to redirect_to(root_url)
end
end
@@ -70,8 +70,7 @@
end
describe "#create" do
- let(:site_id) { "nyc" }
-
+ let(:client_agency_id) { "nyc" }
context "without authentication" do
it "redirects to the homepage without creating any invitation" do
@@ -85,17 +84,17 @@
context "with authentication" do
before do
- stub_site_config_value("nyc", "staff_portal_enabled", true)
+ stub_client_agency_config_value("nyc", "staff_portal_enabled", true)
sign_in nyc_user
end
it "sends an invitation" do
post :create, params: {
- site_id: 'nyc',
+ client_agency_id: 'nyc',
cbv_flow_invitation: valid_params
}
- expect(response).to redirect_to(caseworker_dashboard_url(site_id: valid_params[:site_id]))
+ expect(response).to redirect_to(caseworker_dashboard_url(client_agency_id: valid_params[:client_agency_id]))
end
context "when the CbvInvitationService has an error" do
diff --git a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/ma_spec.rb b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/ma_spec.rb
index b90b0e487..42380965b 100644
--- a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/ma_spec.rb
+++ b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/ma_spec.rb
@@ -1,11 +1,11 @@
require "rails_helper"
RSpec.describe Caseworker::CbvFlowInvitationsController, type: :controller do
- let(:user) { create(:user, email: "test@test.com", site_id: 'ma') }
- let(:ma_params) { { site_id: "ma" } }
+ let(:user) { create(:user, email: "test@test.com", client_agency_id: 'ma') }
+ let(:ma_params) { { client_agency_id: "ma" } }
before do
- stub_site_config_value("ma", "staff_portal_enabled", true)
+ stub_client_agency_config_value("ma", "staff_portal_enabled", true)
sign_in user
end
@@ -35,12 +35,12 @@
describe "#create" do
let(:cbv_flow_invitation_params) do
- attributes_for(:cbv_flow_invitation, site_id: "ma", beacon_id: "ABC123", agency_id_number: "7890120")
+ attributes_for(:cbv_flow_invitation, client_agency_id: "ma", beacon_id: "ABC123", agency_id_number: "7890120")
end
it "creates a CbvFlowInvitation record with the ma fields" do
post :create, params: {
- site_id: ma_params[:site_id],
+ client_agency_id: ma_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
@@ -56,7 +56,7 @@
it "requires the ma fields" do
post :create, params: {
- site_id: "ma",
+ client_agency_id: "ma",
cbv_flow_invitation: cbv_flow_invitation_params.except(:beacon_id, :agency_id_number)
}
expected_errors = [
@@ -69,11 +69,11 @@
it "redirects back to the caseworker dashboard" do
post :create, params: {
- site_id: ma_params[:site_id],
+ client_agency_id: ma_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
- expect(response).to redirect_to(caseworker_dashboard_path(site_id: ma_params[:site_id]))
+ expect(response).to redirect_to(caseworker_dashboard_path(client_agency_id: ma_params[:client_agency_id]))
end
end
end
diff --git a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/nyc_spec.rb b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/nyc_spec.rb
index 57c8f7bae..d54c2d3f8 100644
--- a/app/spec/controllers/caseworker/cbv_flow_invitations_controller/nyc_spec.rb
+++ b/app/spec/controllers/caseworker/cbv_flow_invitations_controller/nyc_spec.rb
@@ -1,11 +1,11 @@
require "rails_helper"
RSpec.describe Caseworker::CbvFlowInvitationsController, type: :controller do
- let(:user) { create(:user, email: "test@test.com", site_id: 'nyc') }
- let(:nyc_params) { { site_id: "nyc" } }
+ let(:user) { create(:user, email: "test@test.com", client_agency_id: 'nyc') }
+ let(:nyc_params) { { client_agency_id: "nyc" } }
before do
- stub_site_config_value("nyc", "staff_portal_enabled", true)
+ stub_client_agency_config_value("nyc", "staff_portal_enabled", true)
sign_in user
end
@@ -35,7 +35,7 @@
it "creates a CbvFlowInvitation record with the nyc fields" do
post :create, params: {
- site_id: nyc_params[:site_id],
+ client_agency_id: nyc_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
@@ -50,7 +50,7 @@
it "creates a CbvFlowInvitation record without optional fields" do
post :create, params: {
- site_id: nyc_params[:site_id],
+ client_agency_id: nyc_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params.except(:middle_name)
}
puts response.inspect
@@ -60,11 +60,11 @@
it "redirects back to the caseworker dashboard" do
post :create, params: {
- site_id: nyc_params[:site_id],
+ client_agency_id: nyc_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
- expect(response).to redirect_to(caseworker_dashboard_path(site_id: nyc_params[:site_id]))
+ expect(response).to redirect_to(caseworker_dashboard_path(client_agency_id: nyc_params[:client_agency_id]))
end
# Note that we are not testing events here because doing so requires use of expect_any_instance_of,
@@ -74,7 +74,7 @@
it "creates a cbv_client record" do
expect {
post :create, params: {
- site_id: nyc_params[:site_id],
+ client_agency_id: nyc_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
}.to change(CbvClient, :count).by(1)
@@ -92,7 +92,7 @@
it "does not create a cbv_client record" do
expect {
post :create, params: {
- site_id: nyc_params[:site_id],
+ client_agency_id: nyc_params[:client_agency_id],
cbv_flow_invitation: cbv_flow_invitation_params
}
}.to change(CbvClient, :count).by(0)
diff --git a/app/spec/controllers/caseworker/dashboards_controller_spec.rb b/app/spec/controllers/caseworker/dashboards_controller_spec.rb
index c3ba6d0ef..6d80cd6dd 100644
--- a/app/spec/controllers/caseworker/dashboards_controller_spec.rb
+++ b/app/spec/controllers/caseworker/dashboards_controller_spec.rb
@@ -12,7 +12,7 @@
end
it "renders successfully" do
- get :show, params: { site_id: user.site_id }
+ get :show, params: { client_agency_id: user.client_agency_id }
expect(response).to be_successful
end
@@ -20,9 +20,9 @@
context "when not authenticated" do
it "redirects to the SSO page" do
- get :show, params: { site_id: "sandbox" }
+ get :show, params: { client_agency_id: "sandbox" }
- expect(response).to redirect_to(new_user_session_path(site_id: "sandbox"))
+ expect(response).to redirect_to(new_user_session_path(client_agency_id: "sandbox"))
end
end
@@ -42,9 +42,9 @@
end
it "redirects to the SSO page" do
- get :show, params: { site_id: "sandbox" }
+ get :show, params: { client_agency_id: "sandbox" }
- expect(response).to redirect_to(new_user_session_path(site_id: "sandbox"))
+ expect(response).to redirect_to(new_user_session_path(client_agency_id: "sandbox"))
end
end
end
diff --git a/app/spec/controllers/caseworker/entries_controller_spec.rb b/app/spec/controllers/caseworker/entries_controller_spec.rb
index af7980a27..2c5451192 100644
--- a/app/spec/controllers/caseworker/entries_controller_spec.rb
+++ b/app/spec/controllers/caseworker/entries_controller_spec.rb
@@ -1,27 +1,27 @@
require "rails_helper"
RSpec.describe Caseworker::EntriesController do
- let(:site_config) { Rails.application.config.sites }
+ let(:client_agency_config) { Rails.application.config.client_agencies }
describe "#index" do
render_views
context "when state is ma" do
it "should show ma specific copy with a link to /sso/ma" do
- agency_short_name = site_config["ma"].agency_short_name
- get :index, params: { site_id: "ma" }
+ agency_short_name = client_agency_config["ma"].agency_short_name
+ get :index, params: { client_agency_id: "ma" }
expect(response).to redirect_to(root_url)
end
end
context "when state is nyc" do
before do
- stub_site_config_value("nyc", "staff_portal_enabled", true)
+ stub_client_agency_config_value("nyc", "staff_portal_enabled", true)
end
it "should show nyc specific copy with a link to /sso/nyc" do
- agency_short_name = site_config["nyc"].agency_short_name
- get :index, params: { site_id: "nyc" }
+ agency_short_name = client_agency_config["nyc"].agency_short_name
+ get :index, params: { client_agency_id: "nyc" }
expect(response).to be_successful
unescaped_body = CGI.unescapeHTML(response.body)
expect(unescaped_body).to include(I18n.t("caseworker.entries.index.header.nyc", agency_short_name: agency_short_name))
@@ -31,12 +31,12 @@
context "when state is disabled" do
before do
- stub_site_config_value("sandbox", "staff_portal_enabled", false)
+ stub_client_agency_config_value("sandbox", "staff_portal_enabled", false)
end
it "redirect to the root page" do
- agency_short_name = site_config["sandbox"].agency_short_name
- get :index, params: { site_id: "sandbox" }
+ agency_short_name = client_agency_config["sandbox"].agency_short_name
+ get :index, params: { client_agency_id: "sandbox" }
expect(response).to redirect_to(root_url)
end
end
diff --git a/app/spec/controllers/cbv/entries_controller_spec.rb b/app/spec/controllers/cbv/entries_controller_spec.rb
index 74cffe9e3..9ec7559f0 100644
--- a/app/spec/controllers/cbv/entries_controller_spec.rb
+++ b/app/spec/controllers/cbv/entries_controller_spec.rb
@@ -48,7 +48,7 @@
cbv_flow_id: be_a(Integer),
timestamp: be_a(Integer),
invitation_id: invitation.id,
- site_id: invitation.site_id,
+ client_agency_id: invitation.client_agency_id,
seconds_since_invitation: seconds_since_invitation
))
@@ -56,14 +56,14 @@
cbv_flow_id: be_a(Integer),
timestamp: be_a(Integer),
invitation_id: invitation.id,
- site_id: invitation.site_id
+ client_agency_id: invitation.client_agency_id
))
expect_any_instance_of(NewRelicEventTracker).to receive(:track).with("ApplicantClickedCBVInvitationLink", anything, hash_including(
cbv_flow_id: be_a(Integer),
timestamp: be_a(Integer),
invitation_id: invitation.id,
- site_id: invitation.site_id,
+ client_agency_id: invitation.client_agency_id,
seconds_since_invitation: seconds_since_invitation
))
@@ -84,7 +84,7 @@
browser: be_a(String),
invitation_id: invitation.id,
cbv_flow_id: be_a(Integer),
- site_id: invitation.site_id,
+ client_agency_id: invitation.client_agency_id,
path: "/cbv/entry"
))
@@ -95,7 +95,7 @@
browser: be_a(String),
invitation_id: invitation.id,
cbv_flow_id: be_a(Integer),
- site_id: invitation.site_id,
+ client_agency_id: invitation.client_agency_id,
path: "/cbv/entry"
))
@@ -110,7 +110,7 @@
browser: be_a(String),
invitation_id: invitation.id,
cbv_flow_id: be_a(Integer),
- site_id: invitation.site_id,
+ client_agency_id: invitation.client_agency_id,
path: "/cbv/entry"
))
@@ -143,7 +143,7 @@
expect { get :show, params: { token: invitation.auth_token } }
.not_to change { session[:cbv_flow_id] }
- expect(response).to redirect_to(cbv_flow_expired_invitation_path(site_id: invitation.site_id))
+ expect(response).to redirect_to(cbv_flow_expired_invitation_path(client_agency_id: invitation.client_agency_id))
end
end
end
@@ -184,7 +184,7 @@
expect { get :show, params: { token: invitation.auth_token } }
.not_to change { session[:cbv_flow_id] }
- expect(response).to redirect_to(cbv_flow_expired_invitation_path(site_id: invitation.site_id))
+ expect(response).to redirect_to(cbv_flow_expired_invitation_path(client_agency_id: invitation.client_agency_id))
end
end
end
diff --git a/app/spec/controllers/cbv/summaries_controller_spec.rb b/app/spec/controllers/cbv/summaries_controller_spec.rb
index 2df189d73..8dab34507 100644
--- a/app/spec/controllers/cbv/summaries_controller_spec.rb
+++ b/app/spec/controllers/cbv/summaries_controller_spec.rb
@@ -9,12 +9,12 @@
let(:employment_errored_at) { nil }
let(:cbv_flow) { create(:cbv_flow, :with_pinwheel_account, created_at: flow_started_seconds_ago.seconds.ago, case_number: "ABC1234", supported_jobs: supported_jobs, employment_errored_at: employment_errored_at) }
let(:cbv_flow_invitation) { cbv_flow.cbv_flow_invitation }
- let(:mock_site) { instance_double(SiteConfig::Site) }
- let(:nyc_user) { create(:user, email: "test@test.com", site_id: 'nyc') }
- let(:ma_user) { create(:user, email: "test@example.com", site_id: 'ma') }
+ let(:mock_client_agency) { instance_double(ClientAgencyConfig::ClientAgency) }
+ let(:nyc_user) { create(:user, email: "test@test.com", client_agency_id: 'nyc') }
+ let(:ma_user) { create(:user, email: "test@example.com", client_agency_id: 'ma') }
before do
- allow(mock_site).to receive(:transmission_method_configuration).and_return({
+ allow(mock_client_agency).to receive(:transmission_method_configuration).and_return({
"bucket" => "test-bucket",
"region" => "us-west-2",
"access_key_id" => "SOME_ACCESS_KEY",
@@ -162,8 +162,8 @@
before do
cbv_flow.update(consented_to_authorized_use_at: Time.now)
sign_in ma_user
- allow(mock_site).to receive(:transmission_method).and_return('s3')
- allow(mock_site).to receive(:id).and_return('ma')
+ allow(mock_client_agency).to receive(:transmission_method).and_return('s3')
+ allow(mock_client_agency).to receive(:id).and_return('ma')
stub_request_end_user_accounts_response
stub_request_end_user_paystubs_response
end
@@ -194,8 +194,8 @@
before do
cbv_flow.update(consented_to_authorized_use_at: Time.now)
- # Set up the mock_site behavior
- allow(mock_site).to receive(:transmission_method_configuration).and_return({
+ # Set up the mock_client_agency behavior
+ allow(mock_client_agency).to receive(:transmission_method_configuration).and_return({
"bucket" => "test-bucket",
"region" => "us-west-2",
"access_key_id" => "SOME_ACCESS_KEY",
@@ -207,11 +207,11 @@
context "when transmission method is shared_email" do
before do
sign_in nyc_user
- allow(mock_site).to receive(:transmission_method).and_return('shared_email')
- allow(mock_site).to receive(:transmission_method_configuration).and_return({
+ allow(mock_client_agency).to receive(:transmission_method).and_return('shared_email')
+ allow(mock_client_agency).to receive(:transmission_method_configuration).and_return({
"email" => 'test@example.com'
})
- allow(controller).to receive(:current_site).and_return(mock_site)
+ allow(controller).to receive(:current_agency).and_return(mock_client_agency)
end
it "sends an email to the caseworker and updates transmitted_at" do
@@ -220,8 +220,6 @@
}.to change { ActionMailer::Base.deliveries.count }.by(1)
.and change { cbv_flow.reload.transmitted_at }.from(nil)
- # expect(controller).to have_received(:current_site)
-
email = ActionMailer::Base.deliveries.last
expect(email.to).to include('test@example.com')
expect(email.subject).to include("Income Verification Report")
@@ -240,7 +238,7 @@
sign_in user
allow(S3Service).to receive(:new).and_return(s3_service_double)
allow(s3_service_double).to receive(:upload_file)
- allow(mock_site).to receive_messages(
+ allow(mock_client_agency).to receive_messages(
id: 'ma',
transmission_method: 's3',
transmission_method_configuration: {
@@ -249,7 +247,7 @@
}
)
- allow(controller).to receive(:current_site).and_return(mock_site)
+ allow(controller).to receive(:current_agency).and_return(mock_client_agency)
# Stub pinwheel_for method to return our double
stub_request_end_user_accounts_response
@@ -277,8 +275,8 @@
csv_content
end
- cbv_flow.update(site_id: "ma")
- cbv_flow_invitation.update(site_id: "ma")
+ cbv_flow.update(client_agency_id: "ma")
+ cbv_flow_invitation.update(client_agency_id: "ma")
cbv_flow_invitation.update(beacon_id: beacon_id)
cbv_flow_invitation.update(agency_id_number: agency_id_number)
@@ -286,7 +284,7 @@
end
it "handles errors during file processing and upload" do
- cbv_flow.update(site_id: 'ma')
+ cbv_flow.update(client_agency_id: 'ma')
allow_any_instance_of(GpgEncryptable).to receive(:gpg_encrypt_file).and_raise(StandardError, "Encryption failed")
expect {
diff --git a/app/spec/controllers/help_controller_spec.rb b/app/spec/controllers/help_controller_spec.rb
index ca6735737..d2fdfcbea 100644
--- a/app/spec/controllers/help_controller_spec.rb
+++ b/app/spec/controllers/help_controller_spec.rb
@@ -5,7 +5,7 @@
let(:valid_params) do
{
topic: "employer",
- site_id: "sandbox"
+ client_agency_id: "sandbox"
}
end
@@ -14,7 +14,7 @@
before do
session[:cbv_flow_id] = cbv_flow.id
- valid_params[:site_id] = cbv_flow.site_id
+ valid_params[:client_agency_id] = cbv_flow.client_agency_id
end
it "tracks events with both trackers" do
@@ -28,7 +28,7 @@
ip: "0.0.0.0",
language: I18n.locale,
locale: nil,
- site_id: cbv_flow.site_id,
+ client_agency_id: cbv_flow.client_agency_id,
topic: "employer",
user_agent: "Rails Testing"
))
@@ -43,7 +43,7 @@
ip: "0.0.0.0",
language: I18n.locale,
locale: nil,
- site_id: cbv_flow.site_id,
+ client_agency_id: cbv_flow.client_agency_id,
topic: "employer",
user_agent: "Rails Testing"
))
@@ -71,7 +71,7 @@
ip: "0.0.0.0",
language: I18n.locale,
locale: nil,
- site_id: "sandbox",
+ client_agency_id: "sandbox",
topic: "employer",
user_agent: "Rails Testing"
))
diff --git a/app/spec/controllers/users/omniauth_callbacks_controller_spec.rb b/app/spec/controllers/users/omniauth_callbacks_controller_spec.rb
index ab62cca87..5fdb3e82f 100644
--- a/app/spec/controllers/users/omniauth_callbacks_controller_spec.rb
+++ b/app/spec/controllers/users/omniauth_callbacks_controller_spec.rb
@@ -18,7 +18,7 @@
describe "#ma_dta" do
context "when the user is authorized" do
before do
- allow(Rails.application.config.sites["ma"])
+ allow(Rails.application.config.client_agencies["ma"])
.to receive(:authorized_emails).and_return(test_email)
end
@@ -30,19 +30,19 @@
new_user = User.last
expect(new_user).to have_attributes(
email: test_email,
- site_id: "ma"
+ client_agency_id: "ma"
)
expect(controller.current_user).to eq(new_user)
end
it "tracks events" do
expect_any_instance_of(MixpanelEventTracker).to receive(:track).with("CaseworkerLogin", anything, hash_including(
- site_id: "ma",
+ client_agency_id: "ma",
user_id: be_a(Integer)
))
expect_any_instance_of(NewRelicEventTracker).to receive(:track).with("CaseworkerLogin", anything, hash_including(
- site_id: "ma",
+ client_agency_id: "ma",
user_id: be_a(Integer)
))
@@ -50,7 +50,7 @@
end
context "when the user already has authenticated before" do
- let!(:existing_user) { create(:user, email: test_email, site_id: "ma") }
+ let!(:existing_user) { create(:user, email: test_email, client_agency_id: "ma") }
it "logs the user into the existing User" do
expect { post :ma_dta }
@@ -69,12 +69,12 @@
end
end
- # Re-using the same email across multiple sites should be only
+ # Re-using the same email across multiple client agencies should be only
# useful to us in development/demo.
context "when the user already has a sandbox account" do
- let!(:existing_user) { create(:user, email: test_email, site_id: "sandbox") }
+ let!(:existing_user) { create(:user, email: test_email, client_agency_id: "sandbox") }
- it "creates a new User for the ma_dta site" do
+ it "creates a new User for the ma_dta client agency" do
expect { post :ma_dta }
.to change(User, :count)
.by(1)
@@ -82,7 +82,7 @@
new_user = User.last
expect(new_user).to have_attributes(
email: test_email,
- site_id: "ma"
+ client_agency_id: "ma"
)
expect(controller.current_user).to eq(new_user)
end
@@ -108,7 +108,7 @@
}
end
- it "creates a User in the correct site and logs them in" do
+ it "creates a User in the correct client agency and logs them in" do
expect { post :nyc_dss }
.to change(User, :count)
.by(1)
@@ -116,7 +116,7 @@
new_user = User.last
expect(new_user).to have_attributes(
email: test_email,
- site_id: "nyc"
+ client_agency_id: "nyc"
)
expect(controller.current_user).to eq(new_user)
end
diff --git a/app/spec/controllers/webhooks/pinwheel/events_controller_spec.rb b/app/spec/controllers/webhooks/pinwheel/events_controller_spec.rb
index 61480ba45..36b2104b6 100644
--- a/app/spec/controllers/webhooks/pinwheel/events_controller_spec.rb
+++ b/app/spec/controllers/webhooks/pinwheel/events_controller_spec.rb
@@ -15,7 +15,7 @@
"X-Timestamp" => "test-timestamp"
}
end
- let(:cbv_flow) { create(:cbv_flow, site_id: "sandbox") }
+ let(:cbv_flow) { create(:cbv_flow, client_agency_id: "sandbox") }
let(:account_id) { "00000000-0000-0000-0000-000000000000" }
before do
diff --git a/app/spec/factories/cbv_flow.rb b/app/spec/factories/cbv_flow.rb
index a14a3c759..31879601b 100644
--- a/app/spec/factories/cbv_flow.rb
+++ b/app/spec/factories/cbv_flow.rb
@@ -3,7 +3,7 @@
association :cbv_flow_invitation, factory: [ :cbv_flow_invitation ]
case_number { "ABC1234" }
- site_id { "sandbox" }
+ client_agency_id { "sandbox" }
trait :completed do
consented_to_authorized_use_at { 10.minutes.ago }
diff --git a/app/spec/factories/cbv_flow_invitation.rb b/app/spec/factories/cbv_flow_invitation.rb
index 3a9972765..29a44b14f 100644
--- a/app/spec/factories/cbv_flow_invitation.rb
+++ b/app/spec/factories/cbv_flow_invitation.rb
@@ -4,13 +4,13 @@
middle_name { "Sue" }
language { :en }
last_name { "Doe" }
- site_id { "sandbox" }
+ client_agency_id { "sandbox" }
email_address { "test@example.com" }
snap_application_date { Time.zone.today.strftime("%m/%d/%Y") }
user
trait :nyc do
- site_id { "nyc" }
+ client_agency_id { "nyc" }
case_number do
number = 11.times.map { rand(10) }.join
@@ -27,7 +27,7 @@
end
trait :ma do
- site_id { "ma" }
+ client_agency_id { "ma" }
agency_id_number do
7.times.map { rand(10) }.join
diff --git a/app/spec/factories/user.rb b/app/spec/factories/user.rb
index b70205200..6b7252a92 100644
--- a/app/spec/factories/user.rb
+++ b/app/spec/factories/user.rb
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :user do
- site_id { "sandbox" }
+ client_agency_id { "sandbox" }
sequence(:email) { |n| "user#{n}@example.com" }
trait :with_access_token do
diff --git a/app/spec/helpers/application_helper_spec.rb b/app/spec/helpers/application_helper_spec.rb
index 2261a77da..83feb4eaf 100644
--- a/app/spec/helpers/application_helper_spec.rb
+++ b/app/spec/helpers/application_helper_spec.rb
@@ -1,8 +1,8 @@
require "rails_helper"
RSpec.describe ApplicationHelper do
- describe "#site_translation" do
- let(:current_site) { Rails.application.config.sites["nyc"] }
+ describe "#agency_translation" do
+ let(:current_agency) { Rails.application.config.client_agencies["nyc"] }
let(:available_translations) { <<~YAML }
some_prefix:
nyc: some string
@@ -11,7 +11,7 @@
before do
without_partial_double_verification do
- allow(helper).to receive(:current_site).and_return(current_site)
+ allow(helper).to receive(:current_agency).and_return(current_agency)
end
end
@@ -25,25 +25,25 @@
I18n.backend = previous_backend
end
- context "when the current_site is specified" do
+ context "when the current_agency is specified" do
it "uses the translation for the proper key" do
- expect(helper.site_translation("some_prefix")).to eq("some string")
+ expect(helper.agency_translation("some_prefix")).to eq("some string")
end
- context "when there is not a translation for that site" do
- let(:current_site) { Rails.application.config.sites["ma"] }
+ context "when there is not a translation for that client agency" do
+ let(:current_agency) { Rails.application.config.client_agencies["ma"] }
it "uses the translation for the default key" do
- expect(helper.site_translation("some_prefix")).to eq("default string")
+ expect(helper.agency_translation("some_prefix")).to eq("default string")
end
end
end
- context "when the current_site is nil" do
- let(:current_site) { nil }
+ context "when the current_agency is nil" do
+ let(:current_agency) { nil }
it "uses the translation for the default key" do
- expect(helper.site_translation("some_prefix")).to eq("default string")
+ expect(helper.agency_translation("some_prefix")).to eq("default string")
end
end
@@ -55,7 +55,7 @@
YAML
it "interpolates the variables" do
- expect(helper.site_translation("some_prefix", variable: "string")).to eq("some string")
+ expect(helper.agency_translation("some_prefix", variable: "string")).to eq("some string")
end
end
@@ -68,42 +68,42 @@
YAML
it "marks the string as HTML safe" do
- expect(helper.site_translation("some_prefix_html")).to eq("some bold text")
- expect(helper.site_translation("some_prefix_html")).to be_html_safe
+ expect(helper.agency_translation("some_prefix_html")).to eq("some bold text")
+ expect(helper.agency_translation("some_prefix_html")).to be_html_safe
end
context "when interpolating a variable" do
- let(:current_site) { Rails.application.config.sites["ma"] }
+ let(:current_agency) { Rails.application.config.client_agencies["ma"] }
it "sanitizes input parameters" do
- expect(helper.site_translation("some_prefix_html", variable: "bold"))
+ expect(helper.agency_translation("some_prefix_html", variable: "bold"))
.to eq("some <strong>bold</strong> text")
- expect(helper.site_translation("some_prefix_html")).to be_html_safe
+ expect(helper.agency_translation("some_prefix_html")).to be_html_safe
end
it "does not sanitize html_safe input parameters" do
- expect(helper.site_translation("some_prefix_html", variable: "bold".html_safe))
+ expect(helper.agency_translation("some_prefix_html", variable: "bold".html_safe))
.to eq("some bold text")
- expect(helper.site_translation("some_prefix_html")).to be_html_safe
+ expect(helper.agency_translation("some_prefix_html")).to be_html_safe
end
end
end
end
describe "#feedback_form_url" do
- let(:current_site) { nil }
+ let(:current_agency) { nil }
let(:params) { {} }
before do
allow(helper).to receive(:params).and_return(params)
without_partial_double_verification do
- allow(helper).to receive(:current_site).and_return(current_site)
+ allow(helper).to receive(:current_agency).and_return(current_agency)
end
end
context "on a CBV flow application page" do
let(:params) { { controller: "cbv/summaries" } }
- let(:current_site) { Rails.application.config.sites["nyc"] }
+ let(:current_agency) { Rails.application.config.client_agencies["nyc"] }
it "shows the applicant-facing Google Form" do
expect(helper.feedback_form_url).to eq(ApplicationHelper::APPLICANT_FEEDBACK_FORM)
@@ -112,10 +112,10 @@
context "on a NYC caseworker-facing page" do
let(:params) { { controller: "caseworker/cbv_flow_invitations" } }
- let(:current_site) { Rails.application.config.sites["nyc"] }
+ let(:current_agency) { Rails.application.config.client_agencies["nyc"] }
it "shows the NYC feedback form" do
- expect(helper.feedback_form_url).to eq(current_site.caseworker_feedback_form)
+ expect(helper.feedback_form_url).to eq(current_agency.caseworker_feedback_form)
end
end
end
diff --git a/app/spec/lib/site_config_spec.rb b/app/spec/lib/site_config_spec.rb
index 6c5a20127..ed36c47e3 100644
--- a/app/spec/lib/site_config_spec.rb
+++ b/app/spec/lib/site_config_spec.rb
@@ -1,6 +1,6 @@
require "rails_helper"
-RSpec.describe SiteConfig do
+RSpec.describe ClientAgencyConfig do
let(:sample_config_path) { "/fake/path.yml" }
let(:sample_config) { <<~YAML }
- id: foo
@@ -22,23 +22,23 @@
end
describe "#initialize" do
- it "loads the site config" do
+ it "loads the client agency config" do
expect do
- SiteConfig.new(sample_config_path)
+ ClientAgencyConfig.new(sample_config_path)
end.not_to raise_error
end
end
- describe "#site_ids" do
+ describe "#client_agency_ids" do
it "returns the IDs" do
- config = SiteConfig.new(sample_config_path)
- expect(config.site_ids).to match_array([ "foo", "bar" ])
+ config = ClientAgencyConfig.new(sample_config_path)
+ expect(config.client_agency_ids).to match_array([ "foo", "bar" ])
end
end
- describe "for a particular site" do
+ describe "for a particular client agency" do
it "returns a key for that agency" do
- config = SiteConfig.new(sample_config_path)
+ config = ClientAgencyConfig.new(sample_config_path)
expect(config["foo"].agency_name).to eq("Foo Agency Name")
end
end
diff --git a/app/spec/mailers/applicant_mailer_spec.rb b/app/spec/mailers/applicant_mailer_spec.rb
index 7f515a839..230f61843 100644
--- a/app/spec/mailers/applicant_mailer_spec.rb
+++ b/app/spec/mailers/applicant_mailer_spec.rb
@@ -94,7 +94,7 @@
end
it "has the correct subject line for ma" do
- invitation.update!(site_id: "ma")
+ invitation.update!(client_agency_id: "ma")
Rake::Task['invitation_reminders:send_all'].execute
email = ActionMailer::Base.deliveries.last
@@ -102,7 +102,7 @@
end
it "has the correct subject line for nyc" do
- invitation.update!(site_id: "nyc", case_number: "00012345678A", client_id_number: "AB00000C", snap_application_date: invitation_sent_at - 30.minutes)
+ invitation.update!(client_agency_id: "nyc", case_number: "00012345678A", client_id_number: "AB00000C", snap_application_date: invitation_sent_at - 30.minutes)
Rake::Task['invitation_reminders:send_all'].execute
email = ActionMailer::Base.deliveries.last
diff --git a/app/spec/mailers/caseworker_mailer_spec.rb b/app/spec/mailers/caseworker_mailer_spec.rb
index d1d8ae323..55081d94f 100644
--- a/app/spec/mailers/caseworker_mailer_spec.rb
+++ b/app/spec/mailers/caseworker_mailer_spec.rb
@@ -8,7 +8,7 @@
let(:cbv_flow) { create(:cbv_flow, :with_pinwheel_account,
case_number: "ABC1234",
confirmation_code: "00001",
- site_id: "nyc",
+ client_agency_id: "nyc",
consented_to_authorized_use_at: Time.now
)}
let(:caseworker_email) { cbv_flow.cbv_flow_invitation.user.email }
@@ -18,7 +18,7 @@
let(:incomes) { stub_incomes(account_id) }
let(:identities) { stub_identities(account_id) }
let(:email_address) { "test@example.com" }
- let(:current_site) { SiteConfig.new(File.join(Rails.root, 'config', 'site-config.yml'))[cbv_flow.site_id] }
+ let(:current_agency) { ClientAgencyConfig.new(File.join(Rails.root, 'config', 'client-agency-config.yml'))[cbv_flow.client_agency_id] }
let(:mail) {
CaseworkerMailer.with(
diff --git a/app/spec/mailers/previews/weekly_report_mailer_preview.rb b/app/spec/mailers/previews/weekly_report_mailer_preview.rb
index 5860eefdb..7dd8bb9e0 100644
--- a/app/spec/mailers/previews/weekly_report_mailer_preview.rb
+++ b/app/spec/mailers/previews/weekly_report_mailer_preview.rb
@@ -1,6 +1,6 @@
# Preview all emails at http://localhost:3000/rails/mailers/weekly_report_mailer_mailer
class WeeklyReportMailerPreview < ActionMailer::Preview
def report_email
- WeeklyReportMailer.with(site_id: "nyc").report_email
+ WeeklyReportMailer.with(client_agency_id: "nyc").report_email
end
end
diff --git a/app/spec/mailers/weekly_report_mailer_spec.rb b/app/spec/mailers/weekly_report_mailer_spec.rb
index 474f3fb24..39d401ae5 100644
--- a/app/spec/mailers/weekly_report_mailer_spec.rb
+++ b/app/spec/mailers/weekly_report_mailer_spec.rb
@@ -5,12 +5,12 @@
include ActiveSupport::Testing::TimeHelpers
let(:now) { DateTime.new(2024, 9, 9, 9, 0, 0, "-04:00") }
- let(:site_id) { "nyc" }
+ let(:client_agency_id) { "nyc" }
let(:invitation_sent_at) { now - 5.days }
let(:snap_app_date) { now.strftime("%Y-%m-%d") }
let(:cbv_flow_invitation) do
create(:cbv_flow_invitation,
- site_id.to_sym,
+ client_agency_id.to_sym,
created_at: invitation_sent_at,
snap_application_date: invitation_sent_at - 1.day,
)
@@ -21,7 +21,7 @@
case_number: cbv_flow_invitation.case_number,
confirmation_code: "00001",
created_at: invitation_sent_at + 15.minutes,
- site_id: site_id,
+ client_agency_id: client_agency_id,
transmitted_at: invitation_sent_at + 30.minutes,
cbv_flow_invitation_id: cbv_flow_invitation.id,
consented_to_authorized_use_at: invitation_sent_at + 30.minutes
@@ -29,7 +29,7 @@
end
let(:mail) do
WeeklyReportMailer
- .with(report_date: now, site_id: cbv_flow.site_id)
+ .with(report_date: now, client_agency_id: cbv_flow.client_agency_id)
.report_email
end
let(:previous_week_start_date) { now.beginning_of_week - 7.days }
@@ -105,7 +105,7 @@
let!(:incomplete_flow) do
create(:cbv_flow, :with_pinwheel_account,
created_at: invitation_sent_at,
- site_id: site_id,
+ client_agency_id: client_agency_id,
cbv_flow_invitation: incomplete_invitation
)
end
@@ -124,8 +124,8 @@
end
end
- context "for the MA site" do
- let(:site_id) { "ma" }
+ context "for the MA client agency" do
+ let(:client_agency_id) { "ma" }
it "renders the CSV data with MA-specific columns" do
expect(mail.attachments.first.filename).to eq("weekly_report_20240902-20240908.csv")
diff --git a/app/spec/models/cbv_flow_invitation_spec.rb b/app/spec/models/cbv_flow_invitation_spec.rb
index c35ace05f..7be5f1744 100644
--- a/app/spec/models/cbv_flow_invitation_spec.rb
+++ b/app/spec/models/cbv_flow_invitation_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe CbvFlowInvitation, type: :model do
let(:valid_attributes) do
- attributes_for(:cbv_flow_invitation, :nyc).merge(user: create(:user, site_id: "nyc"))
+ attributes_for(:cbv_flow_invitation, :nyc).merge(user: create(:user, client_agency_id: "nyc"))
end
let(:invalid_email_no_tld) { "johndoe@gmail" }
let(:valid_email) { "johndoe@gmail.com" }
@@ -86,8 +86,8 @@
end
end
- context "when site_id is 'nyc'" do
- let(:nyc_attributes) { valid_attributes.merge(site_id: 'nyc', user: create(:user, site_id: "nyc")) }
+ context "when client_agency_id is 'nyc'" do
+ let(:nyc_attributes) { valid_attributes.merge(client_agency_id: 'nyc', user: create(:user, client_agency_id: "nyc")) }
context "user input is valid" do
it "formats a 9-character case number with leading zeros" do
@@ -168,8 +168,8 @@
end
end
- context "when site_id is 'ma'" do
- let(:ma_attributes) { valid_attributes.merge(site_id: 'ma') }
+ context "when client_agency_id is 'ma'" do
+ let(:ma_attributes) { valid_attributes.merge(client_agency_id: 'ma') }
context "user input is invalid" do
it "requires agency_id_number" do
@@ -205,7 +205,7 @@
end
it "does not require client_id_number" do
- invitation = CbvFlowInvitation.new(valid_attributes.merge(client_id_number: nil, site_id: "ma"))
+ invitation = CbvFlowInvitation.new(valid_attributes.merge(client_id_number: nil, client_agency_id: "ma"))
expect(invitation).not_to be_valid
expect(invitation.errors[:client_id_number]).to be_empty
end
@@ -214,18 +214,18 @@
end
describe "#expired?" do
- let(:site_id) { "sandbox" }
+ let(:client_agency_id) { "sandbox" }
let(:invitation_valid_days) { 14 }
let(:invitation) do
create(:cbv_flow_invitation, valid_attributes.merge(
- site_id: site_id,
+ client_agency_id: client_agency_id,
created_at: invitation_sent_at
))
end
let(:now) { Time.now }
before do
- allow(Rails.application.config.sites[site_id])
+ allow(Rails.application.config.client_agencies[client_agency_id])
.to receive(:invitation_valid_days)
.and_return(invitation_valid_days)
end
@@ -270,18 +270,18 @@
end
describe "#expires_at" do
- let(:site_id) { "sandbox" }
+ let(:client_agency_id) { "sandbox" }
let(:invitation_valid_days) { 14 }
let(:invitation) do
create(:cbv_flow_invitation, valid_attributes.merge(
- site_id: site_id,
+ client_agency_id: client_agency_id,
created_at: invitation_sent_at
))
end
let(:invitation_sent_at) { Time.new(2024, 8, 1, 12, 0, 0, "-04:00") }
before do
- allow(Rails.application.config.sites[site_id])
+ allow(Rails.application.config.client_agencies[client_agency_id])
.to receive(:invitation_valid_days).and_return(invitation_valid_days)
end
diff --git a/app/spec/models/cbv_flow_spec.rb b/app/spec/models/cbv_flow_spec.rb
index 08122e7ee..fb5b59cf6 100644
--- a/app/spec/models/cbv_flow_spec.rb
+++ b/app/spec/models/cbv_flow_spec.rb
@@ -6,7 +6,7 @@
it "copies over relevant fields" do
cbv_flow = CbvFlow.create_from_invitation(cbv_flow_invitation)
- expect(cbv_flow).to have_attributes(case_number: "ABC1234", site_id: "sandbox")
+ expect(cbv_flow).to have_attributes(case_number: "ABC1234", client_agency_id: "sandbox")
end
end
end
diff --git a/app/spec/models/pinwheel_account_spec.rb b/app/spec/models/pinwheel_account_spec.rb
index 7ed9277f6..64f83a9b5 100644
--- a/app/spec/models/pinwheel_account_spec.rb
+++ b/app/spec/models/pinwheel_account_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe PinwheelAccount, type: :model do
let(:account_id) { SecureRandom.uuid }
let(:supported_jobs) { %w[income paystubs employment] }
- let!(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", pinwheel_token_id: "abc-def-ghi", site_id: "sandbox") }
+ let!(:cbv_flow) { create(:cbv_flow, case_number: "ABC1234", pinwheel_token_id: "abc-def-ghi", client_agency_id: "sandbox") }
let!(:pinwheel_account) do
create(:pinwheel_account,
cbv_flow: cbv_flow,
diff --git a/app/spec/services/pdf_service_spec.rb b/app/spec/services/pdf_service_spec.rb
index 9f6d2534e..2c3a4eafa 100644
--- a/app/spec/services/pdf_service_spec.rb
+++ b/app/spec/services/pdf_service_spec.rb
@@ -5,7 +5,7 @@
include Cbv::PinwheelDataHelper
include ApplicationHelper
- let(:current_site) { Rails.application.config.sites["nyc"] }
+ let(:current_client_agency) { Rails.application.config.client_agencies["nyc"] }
let(:caseworker_user) { create(:user, email: "#{SecureRandom.uuid}@example.com") }
let(:invitation) { create(:cbv_flow_invitation, :nyc, user: caseworker_user) }
let(:cbv_flow) do
@@ -34,7 +34,7 @@
has_consent: false
}
end
- let(:ma_user) { create(:user, email: "test@example.com", site_id: 'ma') }
+ let(:ma_user) { create(:user, email: "test@example.com", client_agency_id: 'ma') }
before do
cbv_flow.pinwheel_accounts.first.update(pinwheel_account_id: "03e29160-f7e7-4a28-b2d8-813640e030d3")
diff --git a/app/spec/support/test_helpers.rb b/app/spec/support/test_helpers.rb
index 4541795b9..e725812ee 100644
--- a/app/spec/support/test_helpers.rb
+++ b/app/spec/support/test_helpers.rb
@@ -101,8 +101,8 @@ def stub_identities(account_id = SecureRandom.uuid)
end
end
- def stub_site_config_value(site, key, value)
- site_config = Rails.application.config.sites[site]
- allow(site_config).to receive(key.to_sym).and_return(value)
+ def stub_client_agency_config_value(client_agency_id, key, value)
+ client_agency_config = Rails.application.config.client_agencies[client_agency_id]
+ allow(client_agency_config).to receive(key.to_sym).and_return(value)
end
end
diff --git a/docs/app/rendered/database-schema.pdf b/docs/app/rendered/database-schema.pdf
index e265cf07a..a1fdfdae0 100644
Binary files a/docs/app/rendered/database-schema.pdf and b/docs/app/rendered/database-schema.pdf differ