diff --git a/app/controllers/flows_controller.rb b/app/controllers/flows_controller.rb
index 3e1b276689..6f2213e756 100644
--- a/app/controllers/flows_controller.rb
+++ b/app/controllers/flows_controller.rb
@@ -320,7 +320,7 @@ def generate_gyr_intake(params)
client = Client.create(
consented_to_service_at: Time.zone.now,
intake_attributes: intake_attributes,
- tax_returns_attributes: [{ year: MultiTenantService.new(:gyr).current_tax_year, is_ctc: false }],
+ tax_returns_attributes: [{ year: MultiTenantService.new(:gyr).current_tax_year(app_time), is_ctc: false }],
)
unless client.valid?
return
diff --git a/app/controllers/hub/clients_controller.rb b/app/controllers/hub/clients_controller.rb
index 7bddb88afd..4f636dd510 100644
--- a/app/controllers/hub/clients_controller.rb
+++ b/app/controllers/hub/clients_controller.rb
@@ -20,12 +20,12 @@ def index
end
def new
- @current_year = MultiTenantService.new(:gyr).current_tax_year
+ @current_year = MultiTenantService.new(:gyr).current_tax_year(app_time)
@form = CreateClientForm.new(gyr_filing_years)
end
def create
- @current_year = MultiTenantService.new(:gyr).current_tax_year
+ @current_year = MultiTenantService.new(:gyr).current_tax_year(app_time)
@form = CreateClientForm.new(gyr_filing_years, create_client_form_params)
assigned_vita_partner = @vita_partners.find_by(id: create_client_form_params["vita_partner_id"])
diff --git a/app/controllers/hub/portal_states_controller.rb b/app/controllers/hub/portal_states_controller.rb
index 19ea454eb0..8f0f08602c 100644
--- a/app/controllers/hub/portal_states_controller.rb
+++ b/app/controllers/hub/portal_states_controller.rb
@@ -49,7 +49,7 @@ def ready_for_8879_signature?(primary_or_spouse)
end
def year
- MultiTenantService.new(:gyr).current_tax_year
+ MultiTenantService.new(:gyr).current_tax_year(app_time)
end
def documents
diff --git a/app/controllers/hub/user_notifications_controller.rb b/app/controllers/hub/user_notifications_controller.rb
index a6d16b187e..845d4b8650 100644
--- a/app/controllers/hub/user_notifications_controller.rb
+++ b/app/controllers/hub/user_notifications_controller.rb
@@ -5,7 +5,13 @@ class UserNotificationsController < Hub::BaseController
def index
@page_title = I18n.t("hub.clients.navigation.notifications")
- @user_notifications = current_user.notifications.where('created_at >= ?', Date.new(Rails.configuration.product_year)).order(created_at: :desc).page(params[:page])
+ cutoff = [
+ app_time - 7.days,
+ Date.new(Rails.configuration.product_year)
+ ].min
+ @user_notifications = current_user.notifications
+ .where('created_at >= ?', cutoff)
+ .order(created_at: :desc).page(params[:page])
end
def mark_all_notifications_read
diff --git a/app/controllers/portal/portal_controller.rb b/app/controllers/portal/portal_controller.rb
index 10dd886eb2..4a6a869bd4 100644
--- a/app/controllers/portal/portal_controller.rb
+++ b/app/controllers/portal/portal_controller.rb
@@ -30,7 +30,7 @@ def current_state
end
def year
- MultiTenantService.new(:gyr).current_tax_year
+ MultiTenantService.new(:gyr).current_tax_year(app_time)
end
def documents
diff --git a/app/controllers/questions/consent_controller.rb b/app/controllers/questions/consent_controller.rb
index 10b4ff7d3b..e5a35f202b 100644
--- a/app/controllers/questions/consent_controller.rb
+++ b/app/controllers/questions/consent_controller.rb
@@ -28,7 +28,7 @@ def after_update_success
# the vita partner the client was routed to has capacity
unless current_intake.client.routing_method_at_capacity?
- InitialTaxReturnsService.new(intake: current_intake).create!
+ InitialTaxReturnsService.new(intake: current_intake, time: app_time).create!
GenerateF13614cPdfJob.perform_later(current_intake.id, "Preliminary 13614-C.pdf")
end
diff --git a/app/controllers/questions/dependents_controller.rb b/app/controllers/questions/dependents_controller.rb
index c9cd9eff7e..f99b41e28d 100644
--- a/app/controllers/questions/dependents_controller.rb
+++ b/app/controllers/questions/dependents_controller.rb
@@ -77,8 +77,8 @@ def next_path
def mixpanel_data(dependent)
{
- dependent_age_at_end_of_tax_year: dependent.age_during(MultiTenantService.new(:gyr).current_tax_year).to_s,
- dependent_under_6: dependent.age_during(MultiTenantService.new(:gyr).current_tax_year) < 6 ? "yes" : "no",
+ dependent_age_at_end_of_tax_year: dependent.age_during(MultiTenantService.new(:gyr).current_tax_year(app_time)).to_s,
+ dependent_under_6: dependent.age_during(MultiTenantService.new(:gyr).current_tax_year(app_time)) < 6 ? "yes" : "no",
dependent_months_in_home: dependent.months_in_home.to_s,
dependent_was_student: dependent.was_student,
dependent_us_citizen: dependent.us_citizen,
diff --git a/app/forms/hub/create_client_form.rb b/app/forms/hub/create_client_form.rb
index 2b939d80f6..0fc37cf60f 100644
--- a/app/forms/hub/create_client_form.rb
+++ b/app/forms/hub/create_client_form.rb
@@ -132,7 +132,7 @@ def default_intake_attributes
end
def create_tax_return_for_year?(year)
- current_year = MultiTenantService.new(:gyr).current_tax_year
+ current_year = MultiTenantService.new(:gyr).current_tax_year(app_time)
if current_year.to_i == year.to_i
attributes_for(:intake)[:needs_help_current_year] == "yes"
else
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 77867edd06..db5bfc0499 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -162,7 +162,7 @@ def ctc_current_tax_year
end
def ctc_prior_tax_year
- MultiTenantService.new(:ctc).prior_tax_year
+ MultiTenantService.new(:ctc).current_tax_year - 1
end
def request_domain
diff --git a/app/helpers/year_selection_helper.rb b/app/helpers/year_selection_helper.rb
index d700f8a3e8..9df4c408c3 100644
--- a/app/helpers/year_selection_helper.rb
+++ b/app/helpers/year_selection_helper.rb
@@ -1,6 +1,7 @@
module YearSelectionHelper
# Year selection for separated, divorced and widowed GYR flow questions
def year_options_from_2018_to_current_tax_yr_plus_one
- (MultiTenantService.new(:gyr).current_tax_year + 1).downto(2018).map { |year| [year.to_s, year.to_s] } + [[t("general.before_2018"), "before 2018"]]
+ (MultiTenantService.new(:gyr).current_tax_year(app_time) + 1)
+ .downto(2018).map { |year| [year.to_s, year.to_s] } + [[t("general.before_2018"), "before 2018"]]
end
end
diff --git a/app/lib/standard_deductions.yml b/app/lib/standard_deductions.yml
index a824b2a2b8..660c5ada4a 100644
--- a/app/lib/standard_deductions.yml
+++ b/app/lib/standard_deductions.yml
@@ -30,6 +30,12 @@ standard_deductions:
head_of_household: 21900
married_filing_jointly: 29200
qualifying_widow: 29200
+ 2025:
+ single: 15750
+ married_filing_separately: 15750
+ head_of_household: 23625
+ married_filing_jointly: 31500
+ qualifying_widow: 31500
base_puerto_rico:
2021:
single: 75000
diff --git a/app/models/intake/gyr_intake.rb b/app/models/intake/gyr_intake.rb
index 1520ebace1..3c0961dc6f 100644
--- a/app/models/intake/gyr_intake.rb
+++ b/app/models/intake/gyr_intake.rb
@@ -615,20 +615,11 @@ def triaged_intake?
end
def self.current_tax_year
- Rails.application.config.gyr_current_tax_year.to_i
+ MultiTenantService.gyr.current_tax_year.to_i
end
- def most_recent_filing_year
- filing_years.first || MultiTenantService.new(:gyr).current_tax_year
- end
-
- def most_recent_needs_help_or_filing_year
- return filing_years.first if filing_years.first.present?
- return MultiTenantService.new(:gyr).current_tax_year - 1 if needs_help_previous_year_1_yes?
- return MultiTenantService.new(:gyr).current_tax_year - 2 if needs_help_previous_year_2_yes?
- return MultiTenantService.new(:gyr).current_tax_year - 3 if needs_help_previous_year_3_yes?
-
- MultiTenantService.new(:gyr).current_tax_year
+ def most_recent_filing_year(time = DateTime.now)
+ filing_years.first || MultiTenantService.new(:gyr).current_tax_year(time)
end
def year_before_most_recent_filing_year
diff --git a/app/models/state_file_dependent.rb b/app/models/state_file_dependent.rb
index 160df87822..2e3410ed08 100644
--- a/app/models/state_file_dependent.rb
+++ b/app/models/state_file_dependent.rb
@@ -91,11 +91,6 @@ class StateFileDependent < ApplicationRecord
message: :blank
}, if: -> { id_has_grocery_credit_ineligible_months == "yes" }, on: :id_grocery_credit_form
- def self.senior_cutoff_date
- # Deprecated: please use `#senior?` (this method used only in tests)
- MultiTenantService.statefile.end_of_current_tax_year.years_ago(65)
- end
-
def full_name
parts = [first_name, middle_initial, last_name]
parts << suffix if suffix.present?
diff --git a/app/services/initial_tax_returns_service.rb b/app/services/initial_tax_returns_service.rb
index b260aa5a85..6563c84cb2 100644
--- a/app/services/initial_tax_returns_service.rb
+++ b/app/services/initial_tax_returns_service.rb
@@ -1,10 +1,11 @@
class InitialTaxReturnsService < BaseService
- def initialize(intake:)
+ def initialize(intake:, time: DateTime.now)
@intake = intake
+ @time = time
end
def create!
- create_year(MultiTenantService.new(:gyr).current_tax_year) if @intake.needs_help_current_year == "yes"
+ create_year(MultiTenantService.new(:gyr).current_tax_year(@time)) if @intake.needs_help_current_year == "yes"
create_year(MultiTenantService.new(:gyr).backtax_years[0]) if @intake.needs_help_previous_year_1 == "yes"
create_year(MultiTenantService.new(:gyr).backtax_years[1]) if @intake.needs_help_previous_year_2 == "yes"
create_year(MultiTenantService.new(:gyr).backtax_years[2]) if @intake.needs_help_previous_year_3 == "yes"
diff --git a/app/services/multi_tenant_service.rb b/app/services/multi_tenant_service.rb
index 47a2e7d05b..ef2b89b321 100644
--- a/app/services/multi_tenant_service.rb
+++ b/app/services/multi_tenant_service.rb
@@ -83,22 +83,14 @@ def delivery_method_options
end
end
- def current_tax_year
+ def current_tax_year(time = DateTime.now)
case service_type
when :ctc then Rails.configuration.ctc_current_tax_year
- when :gyr then Rails.configuration.gyr_current_tax_year
+ when :gyr then gyr_current_tax_year(time)
when :statefile then Rails.configuration.statefile_current_tax_year
end
end
- def end_of_current_tax_year
- DateTime.new(current_tax_year).end_of_year
- end
-
- def prior_tax_year
- current_tax_year - 1
- end
-
def between_deadline_and_end_of_in_progress_intake?(now = DateTime.now)
now.between?(Rails.configuration.tax_deadline, Rails.configuration.end_of_in_progress_intake)
end
@@ -116,8 +108,8 @@ def filing_years(now = DateTime.now)
end
end
- def backtax_years(now = DateTime.now)
- filing_years(now).without(current_tax_year)
+ def backtax_years(time = DateTime.now)
+ filing_years(time).without(current_tax_year(time))
end
def twilio_creds
@@ -148,4 +140,12 @@ def statefile
new(:statefile)
end
end
+
+ private
+
+ def gyr_current_tax_year(time)
+ Rails.configuration.tax_year_filing_seasons.select do |_year, (open_date, _close_date)|
+ time > open_date
+ end.keys.max
+ end
end
diff --git a/app/views/hub/clients/edit_13614c_form_page1.html.erb b/app/views/hub/clients/edit_13614c_form_page1.html.erb
index 82685729f2..faae7f7e5c 100644
--- a/app/views/hub/clients/edit_13614c_form_page1.html.erb
+++ b/app/views/hub/clients/edit_13614c_form_page1.html.erb
@@ -137,7 +137,7 @@
Part II – Marital Status and Household Information
-
<%= t(".what_was_your_marital_status", current_tax_year: MultiTenantService.new(:gyr).current_tax_year) %>
+
<%= t(".what_was_your_marital_status", current_tax_year: MultiTenantService.new(:gyr).current_tax_year(app_time)) %>
<%= f.hub_checkbox(:never_married, t(".fields.never_married"), options: { classes: ["checkbox--wide"], checked_value: "yes", unchecked_value: "no" }) %>
diff --git a/app/views/hub/clients/show.html.erb b/app/views/hub/clients/show.html.erb
index e9278a0d7c..db5d3bccc4 100644
--- a/app/views/hub/clients/show.html.erb
+++ b/app/views/hub/clients/show.html.erb
@@ -345,11 +345,11 @@
Prior Year AGI Amount
- Primary Prior Year (<%= MultiTenantService.new(:ctc).prior_tax_year %>) AGI:
+ Primary Prior Year (<%= ctc_prior_tax_year %>) AGI:
<%= number_to_currency(@client.intake.primary_prior_year_agi_amount || 0) %>
- Spouse Prior Year (<%= MultiTenantService.new(:ctc).prior_tax_year %>) AGI:
+ Spouse Prior Year (<%= ctc_prior_tax_year %>) AGI:
<%= number_to_currency(@client.intake.spouse_prior_year_agi_amount || 0) %>
diff --git a/app/views/questions/backtaxes/edit.html.erb b/app/views/questions/backtaxes/edit.html.erb
index afc03bec6f..a2a1f564e5 100644
--- a/app/views/questions/backtaxes/edit.html.erb
+++ b/app/views/questions/backtaxes/edit.html.erb
@@ -22,13 +22,13 @@
<% gyr_backtax_years.reverse.each do |backtax_year| %>
- <% previous_year_index = MultiTenantService.gyr.current_tax_year - backtax_year %>
+ <% previous_year_index = MultiTenantService.gyr.current_tax_year(app_time) - backtax_year %>
<%= f.cfa_checkbox("needs_help_previous_year_#{previous_year_index}".to_sym,
backtax_year.to_s,
options: { checked_value: "yes", unchecked_value: "no" }) %>
<% end %>
<%= f.cfa_checkbox("needs_help_current_year".to_sym,
- MultiTenantService.gyr.current_tax_year.to_s,
+ MultiTenantService.gyr.current_tax_year(app_time).to_s,
options: { checked_value: "yes", unchecked_value: "no" }) %>
diff --git a/app/views/questions/itemizing/edit.html.erb b/app/views/questions/itemizing/edit.html.erb
index 30dc49e3a2..0ed2704156 100644
--- a/app/views/questions/itemizing/edit.html.erb
+++ b/app/views/questions/itemizing/edit.html.erb
@@ -1,5 +1,5 @@
<% content_for :form_question, t("views.questions.itemizing.title", year: current_intake.most_recent_filing_year) %>
-<% standard_deductions = StandardDeductions.base_deductions(tax_year: MultiTenantService.new(:gyr).current_tax_year) %>
+<% standard_deductions = StandardDeductions.base_deductions(tax_year: MultiTenantService.new(:gyr).current_tax_year(app_time)) %>
<% content_for :form_help_text, t("views.questions.itemizing.help_text",
count: current_intake.filer_count,
joint_deduction: number_to_currency(standard_deductions[:married_filing_jointly]),
diff --git a/app/views/questions/start_with_current_year/edit.html.erb b/app/views/questions/start_with_current_year/edit.html.erb
index 1c58705dde..80d9ad28fe 100644
--- a/app/views/questions/start_with_current_year/edit.html.erb
+++ b/app/views/questions/start_with_current_year/edit.html.erb
@@ -1,4 +1,4 @@
-<% content_for :page_title, t("views.questions.start_with_current_year.title", :year => current_intake.most_recent_filing_year) %>
+<% content_for :page_title, t("views.questions.start_with_current_year.title", :year => current_intake.most_recent_filing_year(app_time)) %>
<% content_for :card do %>
diff --git a/config/application.rb b/config/application.rb
index 4888130daf..4703fa0358 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -81,27 +81,28 @@ class Application < Rails::Application
config.middleware.use Middleware::CleanupMimeTypeHeaders
config.middleware.use Middleware::RejectInvalidParams
config.middleware.use Middleware::RejectBadlyEncodedHeaders
- config.gyr_current_tax_year = 2024
+
config.ctc_current_tax_year = 2021
config.statefile_current_tax_year = 2024
- config.product_year = 2025
+ config.product_year = 2026
pt = Time.find_zone('America/Los_Angeles')
et = Time.find_zone('America/New_York')
# These defaults can be overridden per-environment if needed
# GetYourRefund
- config.start_of_unique_links_only_intake = pt.parse('2025-01-24 12:00:00')
- config.start_of_open_intake = pt.parse('2025-01-31 09:59:59')
- config.tax_deadline = et.parse('2025-04-15 23:59:59')
- config.end_of_intake = et.parse('2025-10-01 23:59:59')
- config.end_of_docs = et.parse('2025-10-08 23:59:59')
- config.doc_submission_deadline = et.parse('2025-04-01 23:59:59')
- config.end_of_closing = et.parse('2025-10-15 23:59:59')
- config.end_of_in_progress_intake = et.parse('2025-10-15 23:59:59')
- config.end_of_login = et.parse('2025-10-23 23:59:00')
+ config.start_of_unique_links_only_intake = pt.parse('2026-01-24 12:00:00')
+ config.start_of_open_intake = pt.parse('2026-01-31 09:59:59')
+ config.tax_deadline = et.parse('2026-04-15 23:59:59')
+ config.end_of_intake = et.parse('2026-10-01 23:59:59')
+ config.end_of_docs = et.parse('2026-10-08 23:59:59')
+ config.doc_submission_deadline = et.parse('2026-04-01 23:59:59')
+ config.end_of_closing = et.parse('2026-10-15 23:59:59')
+ config.end_of_in_progress_intake = et.parse('2026-10-15 23:59:59') # is inprogress just for docs or will they have access to these other pages
+ config.end_of_login = et.parse('2026-10-23 23:59:00')
config.tax_year_filing_seasons = {
+ 2025 => [et.parse("2026-01-29 00:00:00"), et.parse("2026-04-15 23:59:59")],
2024 => [et.parse("2025-01-29 00:00:00"), et.parse("2025-04-15 23:59:59")],
2023 => [et.parse("2024-01-29 00:00:00"), et.parse("2024-04-15 23:59:59")],
2022 => [et.parse("2023-01-23 00:00:00"), et.parse("2023-04-18 23:59:59")],
diff --git a/spec/controllers/hub/clients_controller_spec.rb b/spec/controllers/hub/clients_controller_spec.rb
index 44db945473..a7b555a54b 100644
--- a/spec/controllers/hub/clients_controller_spec.rb
+++ b/spec/controllers/hub/clients_controller_spec.rb
@@ -87,22 +87,22 @@
vita_partner_id: vita_partner_id,
tax_returns_attributes: {
"0": {
- year: Rails.configuration.gyr_current_tax_year.to_s,
+ year: MultiTenantService.new(:gyr).current_tax_year.to_s,
is_hsa: true,
certification_level: "advanced"
},
"1": {
- year: (Rails.configuration.gyr_current_tax_year - 1).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 1).to_s,
is_hsa: false,
certification_level: "basic"
},
"2": {
- year: (Rails.configuration.gyr_current_tax_year - 2).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 2).to_s,
is_hsa: false,
certification_level: "basic"
},
"3": {
- year: (Rails.configuration.gyr_current_tax_year - 3).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 3).to_s,
is_hsa: false,
certification_level: "advanced"
},
diff --git a/spec/controllers/hub/user_notifications_controller_spec.rb b/spec/controllers/hub/user_notifications_controller_spec.rb
index c379811586..0cf2811fe8 100644
--- a/spec/controllers/hub/user_notifications_controller_spec.rb
+++ b/spec/controllers/hub/user_notifications_controller_spec.rb
@@ -157,6 +157,35 @@
end
end
end
+
+ context "when there are notifications before the product year" do
+ let(:before_product_year) { DateTime.new(Rails.configuration.product_year) - 1.month }
+ let!(:old_notification) { create :user_notification, user: user, read: false, created_at: before_product_year }
+
+ context "app_time is before the start of the current product year" do
+ it "shows notifications from the last 7 days" do
+ Timecop.freeze(before_product_year) do
+ get :index
+
+ expect(response).to be_ok
+ expect(assigns(:user_notifications)).to include old_notification
+ expect(assigns(:user_notifications)).to include notification_first
+ end
+ end
+ end
+
+ context "app_time is after the start of the product year" do
+ it "shows notifications from the beginning of the year" do
+ Timecop.freeze(DateTime.new(Rails.configuration.product_year) + 5.month) do
+ get :index
+
+ expect(response).to be_ok
+ expect(assigns(:user_notifications)).not_to include old_notification
+ expect(assigns(:user_notifications)).to include notification_first
+ end
+ end
+ end
+ end
end
end
diff --git a/spec/controllers/portal/portal_controller_spec.rb b/spec/controllers/portal/portal_controller_spec.rb
index 3ca5840091..2eb1ef4168 100644
--- a/spec/controllers/portal/portal_controller_spec.rb
+++ b/spec/controllers/portal/portal_controller_spec.rb
@@ -38,8 +38,8 @@
let(:client) { create :client, intake: (build :intake) }
before do
- create :tax_return, :intake_in_progress, year: (Rails.configuration.gyr_current_tax_year - 2), client: client
- create :tax_return, :prep_ready_for_prep, year: (Rails.configuration.gyr_current_tax_year - 1), client: client
+ create :tax_return, :intake_in_progress, year: (MultiTenantService.new(:gyr).current_tax_year - 2), client: client
+ create :tax_return, :prep_ready_for_prep, year: (MultiTenantService.new(:gyr).current_tax_year - 1), client: client
create :gyr_tax_return, :intake_ready_for_call, client: client
end
@@ -52,7 +52,7 @@
it "loads the client tax returns in desc order" do
get :home
- expect(assigns(:tax_returns).map(&:year)).to eq [Rails.configuration.gyr_current_tax_year, (Rails.configuration.gyr_current_tax_year - 1), (Rails.configuration.gyr_current_tax_year - 2)]
+ expect(assigns(:tax_returns).map(&:year)).to eq [MultiTenantService.new(:gyr).current_tax_year, (MultiTenantService.new(:gyr).current_tax_year - 1), (MultiTenantService.new(:gyr).current_tax_year - 2)]
expect(assigns(:current_step)).to eq nil
end
end
diff --git a/spec/controllers/portal/still_needs_helps_controller_spec.rb b/spec/controllers/portal/still_needs_helps_controller_spec.rb
index ba145e8479..6ccf974aed 100644
--- a/spec/controllers/portal/still_needs_helps_controller_spec.rb
+++ b/spec/controllers/portal/still_needs_helps_controller_spec.rb
@@ -49,7 +49,7 @@
context "client indicates they still need help" do
it "saves answer, tax return statuses, first_unanswered_incoming_interaction_at, and clears triggered_still_needs_help_at" do
- allow(Rails.application.config).to receive(:gyr_current_tax_year).and_return(2021)
+ allow(MultiTenantService.gyr).to receive(:current_tax_year).and_return(2021)
Timecop.freeze(fake_time) { put :update, params: { still_needs_help: "yes" } }
# updates client still needs help fields
diff --git a/spec/controllers/state_file/questions/id_disability_controller_spec.rb b/spec/controllers/state_file/questions/id_disability_controller_spec.rb
index 1a15155f77..71325b2aa0 100644
--- a/spec/controllers/state_file/questions/id_disability_controller_spec.rb
+++ b/spec/controllers/state_file/questions/id_disability_controller_spec.rb
@@ -12,8 +12,8 @@
render_views
let!(:state_file1099_r) { create(:state_file1099_r, intake: intake, taxable_amount: 25) }
- let(:between_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 63), 1, 1) }
- let(:not_between_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 60), 1, 1) }
+ let(:between_dob) { age_at_end_of_tax_year(63) }
+ let(:not_between_dob) { age_at_end_of_tax_year(60) }
it 'succeeds' do
get :edit
diff --git a/spec/factories/state_file_az_intakes.rb b/spec/factories/state_file_az_intakes.rb
index 6cdb1940ef..c4a305a215 100644
--- a/spec/factories/state_file_az_intakes.rb
+++ b/spec/factories/state_file_az_intakes.rb
@@ -148,7 +148,7 @@
spouse_first_name { "Senior" }
spouse_middle_initial { "B" }
spouse_last_name { "Spouse" }
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 70 }
+ spouse_birth_date { age_at_end_of_tax_year(70) }
end
trait :with_az321_contributions do
diff --git a/spec/factories/state_file_dependents.rb b/spec/factories/state_file_dependents.rb
index bbf0e25fb7..519c46eb45 100644
--- a/spec/factories/state_file_dependents.rb
+++ b/spec/factories/state_file_dependents.rb
@@ -37,46 +37,49 @@
# index_state_file_dependents_on_intake (intake_type,intake_id)
#
FactoryBot.define do
+ age_at_statefile_tax_year_end = lambda do |age|
+ DateTime.new(MultiTenantService.statefile.current_tax_year)
+ .end_of_year.years_ago(age)
+ end
+
factory :state_file_dependent do
intake { create :state_file_az_intake }
first_name { "Ali" }
middle_initial {"U"}
last_name { "Poppyseed" }
relationship { "biologicalChild" }
- ssn { "123456789" }
dob { Date.today - 20.years }
factory :az_senior_dependent_missing_intake_answers do
- dob { StateFileDependent.senior_cutoff_date }
+ dob { age_at_statefile_tax_year_end.call(65) }
months_in_home { 12 }
relationship { "parent" }
end
factory :az_senior_dependent do
- dob { StateFileDependent.senior_cutoff_date }
+ dob { age_at_statefile_tax_year_end.call(65) }
needed_assistance { "yes" }
months_in_home { 12 }
relationship { "parent" }
end
factory :az_senior_dependent_no_assistance do
- dob { StateFileDependent.senior_cutoff_date }
+ dob { age_at_statefile_tax_year_end.call(65) }
needed_assistance { "no" }
months_in_home { 12 }
relationship { "parent" }
end
factory :az_hoh_qualifying_person_nonparent do
- dob { StateFileDependent.senior_cutoff_date + 10.years }
+ dob { age_at_statefile_tax_year_end.call(55) }
first_name { "Nonparent" }
last_name { "Qualifying" }
months_in_home { 12 }
relationship { "biologicalChild" }
end
-
factory :az_hoh_qualifying_person_parent do
- dob { StateFileDependent.senior_cutoff_date + 1.years }
+ dob { age_at_statefile_tax_year_end.call(64) }
first_name { "Parent" }
last_name { "Qualifying" }
months_in_home { 0 }
@@ -84,7 +87,7 @@
end
factory :az_hoh_nonqualifying_person_nonparent do
- dob { StateFileDependent.senior_cutoff_date + 5.years }
+ dob { age_at_statefile_tax_year_end.call(60) }
first_name { "Nonparent" }
last_name { "Nonqualifying" }
months_in_home { 5 }
@@ -92,11 +95,11 @@
end
factory :az_hoh_nonqualifying_person_none_relationship do
- dob { StateFileDependent.senior_cutoff_date + 20.years }
+ dob { age_at_statefile_tax_year_end.call(45) }
first_name { "NoneRelationship" }
last_name { "Nonqualifying" }
months_in_home { 12 }
relationship { "noneOfTheAbove" }
end
end
-end
+end
\ No newline at end of file
diff --git a/spec/factories/state_file_md_intakes.rb b/spec/factories/state_file_md_intakes.rb
index 58fecd808d..14735270f4 100644
--- a/spec/factories/state_file_md_intakes.rb
+++ b/spec/factories/state_file_md_intakes.rb
@@ -218,7 +218,7 @@
spouse_first_name { "Marty" }
spouse_middle_initial { "B" }
spouse_last_name { "Lando" }
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 }
+ spouse_birth_date { DateTime.new(MultiTenantService.statefile.current_tax_year).end_of_year.years_ago(40) }
end
trait :with_spouse_ssn_nil do
@@ -228,12 +228,12 @@
spouse_middle_initial { "B" }
spouse_last_name { "Lando" }
spouse_ssn { nil }
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 }
+ spouse_birth_date { DateTime.new(MultiTenantService.statefile.current_tax_year).end_of_year.years_ago(40) }
end
trait :with_senior_spouse do
with_spouse
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 70 }
+ spouse_birth_date { DateTime.new(MultiTenantService.statefile.current_tax_year).end_of_year.years_ago(70) }
end
trait :df_data_2_w2s do
diff --git a/spec/factories/state_file_nc_intakes.rb b/spec/factories/state_file_nc_intakes.rb
index ccfbef533c..28c4f13f38 100644
--- a/spec/factories/state_file_nc_intakes.rb
+++ b/spec/factories/state_file_nc_intakes.rb
@@ -153,7 +153,7 @@
spouse_first_name { "Susie" }
spouse_middle_initial { "B" }
spouse_last_name { "Spouse" }
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 40 }
+ spouse_birth_date { Date.new((MultiTenantService.statefile.current_tax_year - 40), 12, 31) }
end
trait :with_senior_spouse do
@@ -161,7 +161,7 @@
spouse_first_name { "Senior" }
spouse_middle_initial { "B" }
spouse_last_name { "Spouse" }
- spouse_birth_date { MultiTenantService.statefile.end_of_current_tax_year - 70 }
+ spouse_birth_date { Date.new((MultiTenantService.statefile.current_tax_year - 70), 12, 31) }
end
trait :head_of_household do
diff --git a/spec/features/hub/bulk_actions_spec.rb b/spec/features/hub/bulk_actions_spec.rb
index 0700d7c1ec..bffa578a20 100644
--- a/spec/features/hub/bulk_actions_spec.rb
+++ b/spec/features/hub/bulk_actions_spec.rb
@@ -27,14 +27,14 @@
click_on "Change organization"
- expect(page).to have_text "You’ve selected Change Organization for 2 clients"
+ page_change_check("You’ve selected Change Organization for 2 clients")
select "Orange Organization", from: "New organization"
fill_in "Send message (English)", with: "Orange is your best bet"
fill_in "Send message (Spanish)", with: "Naranja es la mejor"
fill_in "Add an internal note", with: "Moved!"
click_on "Submit"
- expect(current_path).to eq hub_user_notifications_path
+ page_change_check(hub_user_notifications_path, path: true)
perform_enqueued_jobs
visit page.current_path
expect(page).to have_text "You successfully moved 2 clients to Orange Organization."
@@ -51,12 +51,12 @@
click_on "Nombre"
end
click_on "Notes"
- expect(page).to have_text "Moved!"
+ page_change_check("Moved!")
perform_enqueued_jobs
click_on "Messages"
- expect(page).to have_text "Naranja es la mejor"
+ page_change_check("Naranja es la mejor")
visit hub_user_notifications_path
within ".in-progress" do
@@ -86,12 +86,12 @@
click_on "Send a message"
- expect(page).to have_text "You’ve selected Send a Message for 2 clients"
+ page_change_check("You’ve selected Send a Message for 2 clients")
fill_in "Send message (English)", with: "Orange is your best bet"
fill_in "Send message (Spanish)", with: "Naranja es la mejor"
click_on "Submit"
- expect(current_path).to eq hub_user_notifications_path
+ page_change_check(hub_user_notifications_path, path: true)
perform_enqueued_jobs
visit page.current_path
expect(page).to have_text "Bulk Send a Message In Progress"
@@ -106,7 +106,7 @@
click_on "Nombre"
end
click_on "Messages"
- expect(page).to have_text "Naranja es la mejor"
+ page_change_check("Naranja es la mejor")
visit hub_user_notifications_path
within ".in-progress" do
@@ -117,7 +117,7 @@
click_on "Name"
end
click_on "Messages"
- expect(page).to have_text "Orange is your best bet"
+ page_change_check("Orange is your best bet")
end
scenario "bulk changing assignee and/or status", js: true do
diff --git a/spec/features/state_file/complete_intake_spec.rb b/spec/features/state_file/complete_intake_spec.rb
index d7a8b7abcb..268718d610 100644
--- a/spec/features/state_file/complete_intake_spec.rb
+++ b/spec/features/state_file/complete_intake_spec.rb
@@ -55,7 +55,7 @@
click_on I18n.t("general.continue")
page_change_check(I18n.t("state_file.questions.az_prior_last_names.edit.title.one"))
- expect(page).to have_text I18n.t("state_file.questions.az_prior_last_names.edit.subtitle", start_year: MultiTenantService.statefile.current_tax_year - 4, end_year: MultiTenantService.statefile.current_tax_year - 1)
+ expect(page).to have_text I18n.t("state_file.questions.az_prior_last_names.edit.subtitle", start_year: filing_year - 4, end_year: filing_year - 1)
choose "state_file_az_prior_last_names_form_has_prior_last_names_yes"
fill_in "state_file_az_prior_last_names_form_prior_last_names", with: "Jordan, Pippen, Rodman"
click_on I18n.t("general.continue")
@@ -121,7 +121,7 @@
page_change_check(I18n.t('state_file.questions.az_qualifying_organization_contributions.index.title'))
click_on I18n.t("general.continue")
- page_change_check(I18n.t("state_file.questions.az_subtractions.edit.title.one", year: MultiTenantService.statefile.current_tax_year))
+ page_change_check(I18n.t("state_file.questions.az_subtractions.edit.title.one", year: filing_year))
check "state_file_az_subtractions_form_tribal_member"
fill_in "state_file_az_subtractions_form_tribal_wages_amount", with: "100"
check "state_file_az_subtractions_form_armed_forces_member"
@@ -132,7 +132,7 @@
choose I18n.t("general.affirmative")
click_on I18n.t("general.continue")
- page_change_check(I18n.t("state_file.questions.extension_payments.az.title", current_year: (MultiTenantService.statefile.current_tax_year + 1)))
+ page_change_check(I18n.t("state_file.questions.extension_payments.az.title", current_year: (filing_year + 1)))
choose I18n.t("general.negative")
click_on I18n.t("general.continue")
@@ -298,7 +298,7 @@
choose I18n.t("general.negative")
click_on I18n.t("general.continue")
- page_change_check(I18n.t("state_file.questions.extension_payments.nc.title", current_year: (MultiTenantService.statefile.current_tax_year + 1)))
+ page_change_check(I18n.t("state_file.questions.extension_payments.nc.title", current_year: (filing_year + 1)))
choose I18n.t("state_file.questions.extension_payments.nc.negative")
click_on I18n.t("general.continue")
@@ -429,13 +429,13 @@
click_on I18n.t("general.continue")
# Extension Payments
- expect(page).to have_text I18n.t("state_file.questions.extension_payments.id.title", current_year: (MultiTenantService.statefile.current_tax_year + 1), tax_year: MultiTenantService.statefile.current_tax_year)
+ expect(page).to have_text I18n.t("state_file.questions.extension_payments.id.title", current_year: (filing_year + 1), tax_year: filing_year)
choose I18n.t("state_file.questions.extension_payments.id.negative")
click_on I18n.t("general.continue")
# Apply Refund
- expect(page).to have_text I18n.t("state_file.questions.apply_refund.edit.title", current_tax_year: MultiTenantService.statefile.current_tax_year, prior_tax_year: MultiTenantService.statefile.current_tax_year - 1)
- choose I18n.t("state_file.questions.apply_refund.edit.negative", current_tax_year: MultiTenantService.statefile.current_tax_year, prior_tax_year: MultiTenantService.statefile.current_tax_year - 1)
+ expect(page).to have_text I18n.t("state_file.questions.apply_refund.edit.title", current_tax_year: filing_year, prior_tax_year: filing_year - 1)
+ choose I18n.t("state_file.questions.apply_refund.edit.negative", current_tax_year: filing_year, prior_tax_year: filing_year - 1)
click_on I18n.t("general.continue")
# Permanent Building Fund
@@ -569,7 +569,7 @@
fill_in 'state_file_md_two_income_subtractions_form[primary_student_loan_interest_ded_amount]', with: "1300.0"
click_on I18n.t("general.continue")
- page_change_check(I18n.t("state_file.questions.extension_payments.md.title", current_year: (MultiTenantService.statefile.current_tax_year + 1)))
+ page_change_check(I18n.t("state_file.questions.extension_payments.md.title", current_year: (filing_year + 1)))
choose I18n.t("state_file.questions.extension_payments.md.negative")
click_on I18n.t("general.continue")
diff --git a/spec/features/state_file/income_review_spec.rb b/spec/features/state_file/income_review_spec.rb
index 6b8086967a..55914142e7 100644
--- a/spec/features/state_file/income_review_spec.rb
+++ b/spec/features/state_file/income_review_spec.rb
@@ -15,11 +15,18 @@ def advance_to_data_transfer
click_on "Start Test NJ"
click_on "Get Started", id: "firstCta"
click_on I18n.t("general.continue")
+
step_through_initial_authentication(contact_preference: :email)
+
+ page_change_check(I18n.t("state_file.questions.notification_preferences.edit.title"))
check "Text message"
fill_in "Your phone number", with: "+12025551212"
click_on "Continue"
+
+ page_change_check(I18n.t("state_file.questions.sms_terms.edit.title"))
click_on I18n.t("general.accept")
+
+ page_change_check(I18n.t("state_file.questions.terms_and_conditions.edit.title"))
click_on I18n.t("state_file.questions.terms_and_conditions.edit.accept")
end
diff --git a/spec/features/web_intake/returning_filer_spec.rb b/spec/features/web_intake/returning_filer_spec.rb
index fd885305ae..d577424d65 100644
--- a/spec/features/web_intake/returning_filer_spec.rb
+++ b/spec/features/web_intake/returning_filer_spec.rb
@@ -37,7 +37,7 @@
click_on I18n.t('general.continue')
# backtaxes
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
# start with current year
@@ -72,7 +72,7 @@
click_on I18n.t('general.continue')
# backtaxes
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
# start with current year
diff --git a/spec/features/web_intake/routing_spec.rb b/spec/features/web_intake/routing_spec.rb
index 4633ff86b5..eda23670b5 100644
--- a/spec/features/web_intake/routing_spec.rb
+++ b/spec/features/web_intake/routing_spec.rb
@@ -93,7 +93,7 @@ def fill_out_notification_preferences(fill_out_optional_consent: true)
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.start_with_current_year.title', year: current_tax_year)
@@ -119,7 +119,7 @@ def fill_out_notification_preferences(fill_out_optional_consent: true)
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.start_with_current_year.title', year: current_tax_year)
@@ -147,7 +147,7 @@ def fill_out_notification_preferences(fill_out_optional_consent: true)
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.start_with_current_year.title', year: current_tax_year)
@@ -181,7 +181,7 @@ def fill_out_notification_preferences(fill_out_optional_consent: true)
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
- check (Rails.configuration.gyr_current_tax_year - 2).to_s
+ check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
click_on I18n.t('general.continue')
expect(page).to have_text I18n.t('views.questions.start_with_current_year.title', year: current_tax_year)
diff --git a/spec/forms/hub/create_client_form_spec.rb b/spec/forms/hub/create_client_form_spec.rb
index 74642ff696..7d78de6843 100644
--- a/spec/forms/hub/create_client_form_spec.rb
+++ b/spec/forms/hub/create_client_form_spec.rb
@@ -66,22 +66,22 @@
primary_tin_type: "ssn",
tax_returns_attributes: {
"0" => {
- year: Rails.configuration.gyr_current_tax_year.to_s,
+ year: MultiTenantService.new(:gyr).current_tax_year.to_s,
is_hsa: "1",
certification_level: "basic"
},
"1" => {
- year: (Rails.configuration.gyr_current_tax_year - 1).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 1).to_s,
is_hsa: "0",
certification_level: "basic"
},
"2" => {
- year: (Rails.configuration.gyr_current_tax_year - 2).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 2).to_s,
is_hsa: "1",
certification_level: "basic"
},
"3" => {
- year: (Rails.configuration.gyr_current_tax_year - 3).to_s,
+ year: (MultiTenantService.new(:gyr).current_tax_year - 3).to_s,
is_hsa: "0",
certification_level: "advanced"
},
@@ -166,7 +166,7 @@
expect(intake.needs_help_previous_year_3).to eq "yes"
expect(intake.needs_help_previous_year_1).to eq "yes"
expect(intake.needs_help_current_year).to eq "yes"
- current_tax_year = Rails.configuration.gyr_current_tax_year
+ current_tax_year = MultiTenantService.new(:gyr).current_tax_year
expect(tax_returns.map(&:year)).to match_array [current_tax_year, (current_tax_year - 1), (current_tax_year - 2), (current_tax_year - 3)]
expect(tax_returns.map(&:client).uniq).to eq [intake.client]
expect(tax_returns.map(&:service_type).uniq).to eq ["drop_off"]
diff --git a/spec/forms/state_file/id_disability_form_spec.rb b/spec/forms/state_file/id_disability_form_spec.rb
index 8b47dc73f7..e35fbb5ea1 100644
--- a/spec/forms/state_file/id_disability_form_spec.rb
+++ b/spec/forms/state_file/id_disability_form_spec.rb
@@ -3,8 +3,8 @@
RSpec.describe StateFile::IdDisabilityForm do
let(:intake) { create :state_file_id_intake }
let(:form) { described_class.new(intake, params) }
- let(:senior_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
- let(:not_senior_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 63), 1, 1) }
+ let(:senior_dob) { age_at_end_of_tax_year(65) }
+ let(:not_senior_dob) { age_at_end_of_tax_year(63) }
describe "#valid?" do
diff --git a/spec/jobs/bulk_action_job_spec.rb b/spec/jobs/bulk_action_job_spec.rb
index 18c753cbc0..8b5a23da16 100644
--- a/spec/jobs/bulk_action_job_spec.rb
+++ b/spec/jobs/bulk_action_job_spec.rb
@@ -397,7 +397,7 @@
form_params: params
)
- expect(client.reload.system_notes.map(&:body)).to include "#{team_member.name_with_role} updated #{Rails.configuration.gyr_current_tax_year} tax return status from Final steps/Ready to file to Quality review/Ready for call"
+ expect(client.reload.system_notes.map(&:body)).to include "#{team_member.name_with_role} updated #{MultiTenantService.new(:gyr).current_tax_year} tax return status from Final steps/Ready to file to Quality review/Ready for call"
end
context "when 'Keep current status' is selected" do
diff --git a/spec/lib/efile/md/md502b_calculator_spec.rb b/spec/lib/efile/md/md502b_calculator_spec.rb
index b054f59563..4af78cdfc8 100644
--- a/spec/lib/efile/md/md502b_calculator_spec.rb
+++ b/spec/lib/efile/md/md502b_calculator_spec.rb
@@ -1,9 +1,11 @@
require 'rails_helper'
describe Efile::Md::Md502bCalculator do
+ include StateFileIntakeHelper
+
let(:intake) { create(:state_file_md_intake) }
- let!(:regular_dependent) { create(:state_file_dependent, intake: intake, dob: StateFileDependent.senior_cutoff_date + 60.years) }
- let!(:senior_dependent) { create(:state_file_dependent, intake: intake, dob: StateFileDependent.senior_cutoff_date) }
+ let!(:regular_dependent) { create(:state_file_dependent, intake: intake, dob: age_at_end_of_tax_year(5)) }
+ let!(:senior_dependent) { create(:state_file_dependent, intake: intake, dob: senior_cutoff_date) }
let(:main_calculator) do
Efile::Md::Md502Calculator.new(
year: MultiTenantService.statefile.current_tax_year,
diff --git a/spec/lib/pdf_filler/md_502b_pdf_spec.rb b/spec/lib/pdf_filler/md_502b_pdf_spec.rb
index 57c3d547f2..772a100f9c 100644
--- a/spec/lib/pdf_filler/md_502b_pdf_spec.rb
+++ b/spec/lib/pdf_filler/md_502b_pdf_spec.rb
@@ -2,6 +2,7 @@
RSpec.describe PdfFiller::Md502bPdf do
include PdfSpecHelper
+ include StateFileIntakeHelper
let(:primary_ssn) { "345678901" }
let(:spouse_ssn) { "987654321" }
@@ -21,8 +22,8 @@
end
let(:submission) { create :efile_submission, :for_state, data_source: intake }
let(:pdf) { described_class.new(submission) }
- let(:young_dob) { StateFileDependent.senior_cutoff_date + 60.years }
- let(:old_dob) { StateFileDependent.senior_cutoff_date }
+ let(:young_dob) { age_at_end_of_tax_year(5) }
+ let(:old_dob) { senior_cutoff_date }
let!(:dependent) do
create(
:state_file_dependent,
diff --git a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb
index 11adcb29b6..003a24ff6f 100644
--- a/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb
+++ b/spec/lib/submission_builder/ty2022/states/az/az_return_xml_spec.rb
@@ -158,7 +158,7 @@
end
context "when a dependent is over 65 and a qualifying parent or grandparent" do
- let(:dob) { MultiTenantService.statefile.end_of_current_tax_year - 65.years }
+ let(:dob) { age_at_end_of_tax_year(65) }
before do
create :state_file_dependent,
diff --git a/spec/lib/submission_builder/ty2024/states/md/documents/md502b_spec.rb b/spec/lib/submission_builder/ty2024/states/md/documents/md502b_spec.rb
index 0a6cb2a0af..18d21e8581 100644
--- a/spec/lib/submission_builder/ty2024/states/md/documents/md502b_spec.rb
+++ b/spec/lib/submission_builder/ty2024/states/md/documents/md502b_spec.rb
@@ -1,6 +1,8 @@
require 'rails_helper'
describe SubmissionBuilder::Ty2024::States::Md::Documents::Md502b, required_schema: "md" do
+ include StateFileIntakeHelper
+
describe ".document" do
let(:intake) { create(:state_file_md_intake) }
let(:submission) { create(:efile_submission, data_source: intake) }
@@ -30,8 +32,8 @@
end
context "filling out dependent details" do
- let(:young_dob) { StateFileDependent.senior_cutoff_date + 60.years }
- let(:old_dob) { StateFileDependent.senior_cutoff_date }
+ let(:young_dob) { age_at_end_of_tax_year(5) }
+ let(:old_dob) { senior_cutoff_date }
let!(:dependent) do
create(
:state_file_dependent,
diff --git a/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb b/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb
index 897e75eee7..b265e1f071 100644
--- a/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb
+++ b/spec/lib/submission_builder/ty2024/states/md/md_return_xml_spec.rb
@@ -1,6 +1,8 @@
require 'rails_helper'
describe SubmissionBuilder::Ty2024::States::Md::MdReturnXml, required_schema: "md" do
+ include StateFileIntakeHelper
+
describe ".build" do
let(:intake) { create(:state_file_md_intake, primary_esigned: "yes", primary_esigned_at: Time.now, primary_signature_pin: "11111" ) }
let(:submission) { create(:efile_submission, data_source: intake.reload) }
@@ -100,7 +102,7 @@
context "502B" do
context "when there are dependents" do
- let!(:dependent) { create :state_file_dependent, dob: StateFileDependent.senior_cutoff_date + 20.years, intake: intake }
+ let!(:dependent) { create :state_file_dependent, dob: age_at_end_of_tax_year(45), intake: intake }
it "includes the document" do
expect(xml.document.at('ReturnDataState Form502B')).to be_an_instance_of Nokogiri::XML::Element
diff --git a/spec/models/intake/gyr_intake_spec.rb b/spec/models/intake/gyr_intake_spec.rb
index d92b5f1571..ba7bb9335f 100644
--- a/spec/models/intake/gyr_intake_spec.rb
+++ b/spec/models/intake/gyr_intake_spec.rb
@@ -544,28 +544,6 @@
end
end
- describe "#most_recent_needs_help_or_filing_year" do
- let(:intake) { build(:intake) }
-
- context "when there are no tax returns" do
- context "when client has said which years they need help" do
- before do
- intake.update(needs_help_previous_year_3: "yes", needs_help_previous_year_2: "yes")
- end
-
- it "gives the highest needs_help year number" do
- expect(intake.most_recent_needs_help_or_filing_year).to eq MultiTenantService.new(:gyr).current_tax_year - 2
- end
- end
-
- context "when the client has not said they need help any particular years" do
- it "uses the current tax year" do
- expect(intake.most_recent_needs_help_or_filing_year).to eq MultiTenantService.new(:gyr).current_tax_year
- end
- end
- end
- end
-
describe "#year_before_most_recent_filing_year" do
let(:intake) { build :intake }
let!(:client) { create :client, tax_returns: [], intake: intake }
diff --git a/spec/models/intake_spec.rb b/spec/models/intake_spec.rb
index a235a88c0a..3ff8c105c6 100644
--- a/spec/models/intake_spec.rb
+++ b/spec/models/intake_spec.rb
@@ -764,12 +764,12 @@
context "with a couple filing years selected" do
let!(:client) { create :client, tax_returns: [
- build(:tax_return, year: (Rails.configuration.gyr_current_tax_year - 1)),
+ build(:tax_return, year: (MultiTenantService.new(:gyr).current_tax_year - 1)),
build(:gyr_tax_return)
], intake: intake }
it "returns them as an array" do
- expect(intake.filing_years).to eq([Rails.configuration.gyr_current_tax_year, (Rails.configuration.gyr_current_tax_year - 1)])
+ expect(intake.filing_years).to eq([MultiTenantService.new(:gyr).current_tax_year, (MultiTenantService.new(:gyr).current_tax_year - 1)])
end
end
end
diff --git a/spec/models/state_file/state_file_dependent_spec.rb b/spec/models/state_file/state_file_dependent_spec.rb
index 1abc2a6058..aae0f2b62d 100644
--- a/spec/models/state_file/state_file_dependent_spec.rb
+++ b/spec/models/state_file/state_file_dependent_spec.rb
@@ -1,6 +1,8 @@
require "rails_helper"
describe StateFileDependent do
+ include StateFileIntakeHelper
+
describe "validations" do
context "in the az_senior_form context" do
context "when needed assistance is yes" do
@@ -52,7 +54,7 @@
describe "#ask_senior_questions?" do
let(:dependent) { build(:state_file_dependent, dob: dob, months_in_home: months_in_home, relationship: relationship, intake: intake) }
let(:relationship) { "grandParent" }
- let(:dob) { described_class.senior_cutoff_date }
+ let(:dob) { senior_cutoff_date }
let(:months_in_home) { 12 }
let(:intake) { build :state_file_az_intake }
@@ -96,14 +98,14 @@
end
context "when a dependent is younger than 65" do
- let(:dob) { described_class.senior_cutoff_date + 1.week }
+ let(:dob) { senior_cutoff_date + 1.week }
it "does NOT ask more questions" do
expect(dependent.ask_senior_questions?).to be false
end
end
context "when dependent's birthday is one day from the cutoff (January 1st)" do
- let(:dob) { described_class.senior_cutoff_date + 1.day }
+ let(:dob) { senior_cutoff_date + 1.day }
context "when Maryland intake" do
let(:intake) { build :state_file_md_intake }
it "doesn't ask more questions" do
@@ -131,35 +133,35 @@
it "only returns dependents that are 65+ by end of tax year, a grandparent or parent, spent 12 months in home, and needed assistance" do
qualifying_grandparent = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date,
+ dob: senior_cutoff_date,
months_in_home: 12,
needed_assistance: "yes",
relationship: "grandParent"
)
qualifying_parent = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date,
+ dob: senior_cutoff_date,
months_in_home: 12,
needed_assistance: "yes",
relationship: "parent"
)
too_young = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date + 2.day,
+ dob: senior_cutoff_date + 2.day,
months_in_home: 12,
needed_assistance: "yes",
relationship: "grandParent"
)
jan_1_az_intake = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date + 1.day,
+ dob: senior_cutoff_date + 1.day,
months_in_home: 12,
needed_assistance: "yes",
relationship: "grandParent"
)
jan_1_md_intake = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date + 1.day,
+ dob: senior_cutoff_date + 1.day,
months_in_home: 12,
needed_assistance: "yes",
relationship: "grandParent",
@@ -167,21 +169,21 @@
)
not_ancestor = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date,
+ dob: senior_cutoff_date,
months_in_home: 12,
needed_assistance: "yes",
relationship: "biologicalChild"
)
too_few_months = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date,
+ dob: senior_cutoff_date,
months_in_home: 11,
needed_assistance: "yes",
relationship: "grandParent"
)
did_not_need_assistance = build(
:state_file_dependent,
- dob: described_class.senior_cutoff_date,
+ dob: senior_cutoff_date,
months_in_home: 12,
needed_assistance: "no",
relationship: "grandParent"
@@ -270,10 +272,10 @@
end
describe "#senior?" do
- let(:dob_jan_1_64_years_ago) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 64), 1, 1) }
+ let(:dob_jan_1_64_years_ago) { Date.new((MultiTenantService.statefile.current_tax_year - 64), 1, 1) }
let(:dependent_65_next_year) { create :state_file_dependent, dob: dob_jan_1_64_years_ago, intake: intake }
- let(:dob_jan_1_65_years_ago) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
+ let(:dob_jan_1_65_years_ago) { Date.new((MultiTenantService.statefile.current_tax_year - 65), 1, 1) }
let(:dependent_65_this_year) { create :state_file_dependent, dob: dob_jan_1_65_years_ago, intake: intake }
let(:intake) { create :state_file_az_intake }
diff --git a/spec/models/state_file_az_intake_spec.rb b/spec/models/state_file_az_intake_spec.rb
index aff3ae09fc..cf5bf08413 100644
--- a/spec/models/state_file_az_intake_spec.rb
+++ b/spec/models/state_file_az_intake_spec.rb
@@ -95,6 +95,8 @@
require "rails_helper"
describe StateFileAzIntake do
+ include StateFileIntakeHelper
+
it_behaves_like :state_file_base_intake, factory: :state_file_az_intake
describe "before_save" do
@@ -256,7 +258,7 @@
it 'returns the correct dependents under 17' do
create :state_file_dependent, intake: intake,
- dob: (MultiTenantService.statefile.end_of_current_tax_year - 10.years)
+ dob: age_at_end_of_tax_year(10)
.strftime("%Y-%m-%d")
expect(intake.federal_dependent_count_under_17).to eq(1)
expect(intake.federal_dependent_count_over_17_non_qualifying_senior).to eq(0)
@@ -265,7 +267,7 @@
it 'returns the correct dependents over 17' do
create :state_file_dependent, intake: intake,
- dob: (MultiTenantService.statefile.end_of_current_tax_year - 20.years)
+ dob: age_at_end_of_tax_year(20)
.strftime("%Y-%m-%d")
expect(intake.federal_dependent_count_under_17).to eq(0)
expect(intake.federal_dependent_count_over_17_non_qualifying_senior).to eq(1)
diff --git a/spec/models/state_file_md_intake_spec.rb b/spec/models/state_file_md_intake_spec.rb
index 0bd952740d..04c877aeb7 100644
--- a/spec/models/state_file_md_intake_spec.rb
+++ b/spec/models/state_file_md_intake_spec.rb
@@ -119,9 +119,11 @@
require 'rails_helper'
RSpec.describe StateFileMdIntake, type: :model do
+ include StateFileIntakeHelper
+
describe "#calculate_age" do
let(:intake) { create :state_file_md_intake, primary_birth_date: dob }
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 10), 1, 1) }
+ let(:dob) { Date.new((MultiTenantService.statefile.current_tax_year - 10), 1, 1) }
it "doesn't include Jan 1st in the past tax year" do
expect(intake.calculate_age(dob, inclusive_of_jan_1: true)).to eq 10
@@ -132,7 +134,7 @@
describe "is_filer_55_and_older?" do
context "when primary is 55 or older" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 55), 1, 1) }
+ let(:dob) { Date.new((MultiTenantService.statefile.current_tax_year - 55), 1, 1) }
let(:intake) { create :state_file_md_intake, primary_birth_date: dob }
it "returns true" do
expect(intake.is_filer_55_and_older?(:primary)).to eq true
@@ -141,14 +143,14 @@
context "when the primary is younger than 55" do
let!(:intake) { create :state_file_md_intake, primary_birth_date: dob }
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 54), 1, 1) }
+ let(:dob) { Date.new((MultiTenantService.statefile.current_tax_year - 54), 1, 1) }
it "returns true" do
expect(intake.is_filer_55_and_older?(:primary)).to eq false
end
end
context "when the spouse is 55 or older" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 55), 1, 1) }
+ let(:dob) { Date.new((MultiTenantService.statefile.current_tax_year - 55), 1, 1) }
let(:intake) { create :state_file_md_intake, spouse_birth_date: dob }
it "returns true" do
expect(intake.is_filer_55_and_older?(:spouse)).to eq true
@@ -156,7 +158,7 @@
end
context "when the spouse is younger than 55" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 54), 1, 1) }
+ let(:dob) { Date.new((MultiTenantService.statefile.current_tax_year - 54), 1, 1) }
let(:intake) { create :state_file_md_intake, spouse_birth_date: dob }
it "returns true" do
expect(intake.is_filer_55_and_older?(:spouse)).to eq false
@@ -459,8 +461,8 @@
before do
allow_any_instance_of(StateFileMdIntake).to receive(:at_least_one_disabled_filer_with_proof?).and_return is_disabled
end
- let(:senior_primary_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
- let(:non_senior_spouse_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 64), 1, 1) }
+ let(:senior_primary_dob) { Date.new((MultiTenantService.statefile.current_tax_year - 65), 1, 1) }
+ let(:non_senior_spouse_dob) { Date.new((MultiTenantService.statefile.current_tax_year - 64), 1, 1) }
let(:intake) { create :state_file_md_intake, :with_spouse, primary_birth_date: senior_primary_dob, spouse_birth_date: non_senior_spouse_dob }
@@ -501,7 +503,7 @@
let(:spouse_dob) { nil }
context "under 65" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 55), 1, 1) }
+ let(:dob) { age_at_end_of_tax_year(55) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(true)
@@ -509,7 +511,7 @@
end
context "over 65" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
+ let(:dob) { age_at_end_of_tax_year(66) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(false)
@@ -519,11 +521,11 @@
context "mfj" do
let(:filing_status) { "married_filing_jointly" }
- let(:spouse_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 70), 1, 1) }
+ let(:spouse_dob) { age_at_end_of_tax_year(70) }
context "primary" do
context "under 65" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 55), 1, 1) }
+ let(:dob) { age_at_end_of_tax_year(64) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(true)
@@ -531,7 +533,7 @@
end
context "over 65" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
+ let(:dob) { age_at_end_of_tax_year(66) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(false)
@@ -540,10 +542,10 @@
end
context "spouse" do
- let(:dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 70), 1, 1) }
+ let(:dob) { age_at_end_of_tax_year(70) }
context "under 65" do
- let(:spouse_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 55), 1, 1) }
+ let(:spouse_dob) { age_at_end_of_tax_year(55) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(true)
@@ -551,7 +553,7 @@
end
context "over 65" do
- let(:spouse_dob) { Date.new((MultiTenantService.statefile.end_of_current_tax_year.year - 65), 1, 1) }
+ let(:spouse_dob) { age_at_end_of_tax_year(66) }
it "returns true" do
expect(intake.has_filer_under_65?).to eq(false)
diff --git a/spec/models/tax_return_spec.rb b/spec/models/tax_return_spec.rb
index 99903c00cd..b2f72de4e4 100644
--- a/spec/models/tax_return_spec.rb
+++ b/spec/models/tax_return_spec.rb
@@ -68,7 +68,7 @@
"greetable" => false,
"service_type" => "online_intake",
"stage" => nil,
- "year" => Rails.configuration.gyr_current_tax_year
+ "year" => MultiTenantService.new(:gyr).current_tax_year
}
expect(tax_return.client.reload.filterable_tax_return_properties).to eq([expected_tax_return_properties])
end
@@ -87,7 +87,7 @@
"greetable" => false,
"service_type" => "online_intake",
"stage" => nil,
- "year" => Rails.configuration.gyr_current_tax_year
+ "year" => MultiTenantService.new(:gyr).current_tax_year
}
expect(client.reload.filterable_tax_return_properties).to eq([expected_properties])
tax_return.destroy
@@ -934,7 +934,7 @@
context "when born on/after Jan 2, 1958 for tax year 64 years ago" do
before do
- tax_return.intake.update(primary_birth_date: Date.new(Rails.configuration.gyr_current_tax_year - 64, 1, 2))
+ tax_return.intake.update(primary_birth_date: Date.new(MultiTenantService.new(:gyr).current_tax_year - 64, 1, 2))
end
it "returns false" do
@@ -948,7 +948,7 @@
context "when born before Jan 2, 1958 for tax year 64 years ago" do
before do
- tax_return.intake.update(spouse_birth_date: Date.new(Rails.configuration.gyr_current_tax_year - 64, 1, 1))
+ tax_return.intake.update(spouse_birth_date: Date.new(MultiTenantService.new(:gyr).current_tax_year - 64, 1, 1))
end
it "returns true" do
@@ -958,7 +958,7 @@
context "when born on/after Jan 2, 1958 for tax year 64 years ago" do
before do
- tax_return.intake.update(spouse_birth_date: Date.new(Rails.configuration.gyr_current_tax_year - 64, 1, 2))
+ tax_return.intake.update(spouse_birth_date: Date.new(MultiTenantService.new(:gyr).current_tax_year - 64, 1, 2))
end
it "returns false" do
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index be5e5195fe..97e2523bf1 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -96,7 +96,6 @@ def filling_in_ssn_without_dashes(args)
config.include Devise::Test::ControllerHelpers, type: :controller
config.include ChannelHelpers, type: :channel
config.include ActiveSupport::Testing::TimeHelpers
- config.include NavigationHelpers
config.include FeatureHelpers, type: :feature
config.include ResponsiveHelper, type: :feature
config.include JavascriptHelpers, type: :feature
diff --git a/spec/services/incoming_text_message_service_spec.rb b/spec/services/incoming_text_message_service_spec.rb
index 9d6239fdc4..7d83e9f420 100644
--- a/spec/services/incoming_text_message_service_spec.rb
+++ b/spec/services/incoming_text_message_service_spec.rb
@@ -71,7 +71,7 @@
end
context "has all tax return status in file_accepted, file_mailed or file_not_filing" do
- let!(:tax_returns) { [(build :gyr_tax_return, :file_not_filing), (build :tax_return, :file_accepted, year: 2019)] }
+ let!(:tax_returns) { [(build :gyr_tax_return, :file_not_filing), (build :tax_return, :file_accepted, year: MultiTenantService.gyr.current_tax_year - 2)] }
before do
AdminToggle.create(name: AdminToggle::FORWARD_MESSAGES_TO_INTERCOM, value: true, user: create(:admin_user))
diff --git a/spec/services/multi_tenant_service_spec.rb b/spec/services/multi_tenant_service_spec.rb
index 729b3a474c..bdd90809bc 100644
--- a/spec/services/multi_tenant_service_spec.rb
+++ b/spec/services/multi_tenant_service_spec.rb
@@ -39,16 +39,6 @@
end
end
- describe "#end_of_current_tax_year" do
- before do
- allow(Rails.application.config).to receive(:statefile_current_tax_year).and_return(2023)
- end
-
- it "returns the last day of the tax year" do
- expect(described_class.new(:statefile).end_of_current_tax_year).to eq DateTime.new(2023).end_of_year
- end
- end
-
describe "#prior_tax_year" do
before do
allow(Rails.application.config).to receive(:ctc_current_tax_year).and_return(2017)
diff --git a/spec/services/state_file/reminder_to_finish_state_return_service_spec.rb b/spec/services/state_file/reminder_to_finish_state_return_service_spec.rb
index 6701865890..8d4f25c90c 100644
--- a/spec/services/state_file/reminder_to_finish_state_return_service_spec.rb
+++ b/spec/services/state_file/reminder_to_finish_state_return_service_spec.rb
@@ -14,6 +14,7 @@
let!(:intake) do
create :state_file_az_intake,
df_data_imported_at: fake_time - 6.hours - 1.minute,
+ created_at: fake_time,
email_address_verified_at: 7.hours.ago,
email_notification_opt_in: "yes",
email_address: "dezie@example.com",
diff --git a/spec/support/helpers/ctc_intake_feature_helper.rb b/spec/support/helpers/ctc_intake_feature_helper.rb
index 86ffcde6e0..bf284af5a6 100644
--- a/spec/support/helpers/ctc_intake_feature_helper.rb
+++ b/spec/support/helpers/ctc_intake_feature_helper.rb
@@ -74,7 +74,7 @@ def fill_in_eligibility(home_location: "fifty_states")
def fill_in_basic_info(home_location: "fifty_states", birthdate: DateTime.new(1996, 8, 24))
ctc_current_tax_year = MultiTenantService.new(:ctc).current_tax_year
- ctc_prior_tax_year = MultiTenantService.new(:ctc).prior_tax_year
+ ctc_prior_tax_year = ctc_prior_tax_year
# =========== BASIC INFO ===========
expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.legal_consent.title'))
@@ -595,6 +595,6 @@ def current_tax_year
end
def prior_tax_year
- MultiTenantService.new(:ctc).prior_tax_year
+ ctc_prior_tax_year
end
end
diff --git a/spec/support/helpers/state_file_intake_helper.rb b/spec/support/helpers/state_file_intake_helper.rb
index 88a5c4a874..8e5f32468a 100644
--- a/spec/support/helpers/state_file_intake_helper.rb
+++ b/spec/support/helpers/state_file_intake_helper.rb
@@ -3,6 +3,14 @@ def filing_year
MultiTenantService.statefile.current_tax_year
end
+ def senior_cutoff_date
+ age_at_end_of_tax_year(65)
+ end
+
+ def age_at_end_of_tax_year(age)
+ DateTime.new(filing_year).end_of_year.years_ago(age)
+ end
+
def step_through_eligibility_screener(us_state:)
case us_state
when "ny"
diff --git a/spec/support/navigation_helpers.rb b/spec/support/navigation_helpers.rb
deleted file mode 100644
index 5f44f65a15..0000000000
--- a/spec/support/navigation_helpers.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-module NavigationHelpers
- def authenticate_client(client)
- expect(page).to have_text I18n.t("portal.client_logins.new.title")
- fill_in "Email address", with: client.intake.email_address
- click_on "Send code"
- expect(page).to have_text "Let’s verify that code!"
-
- perform_enqueued_jobs
-
- mail = ActionMailer::Base.deliveries.last
- code = mail.html_part.body.to_s.match(%r{
(\d{6})\.})[1]
-
- fill_in "Enter 6 digit code", with: code
- click_on "Verify"
-
- fill_in "Client ID or Last 4 of SSN/ITIN", with: client.id
- click_on "Continue"
- end
-
- def go_back
- page.evaluate_script('window.history.back()')
- end
-
- def fill_out_personal_information(name: "Betty Banana", zip_code:, birth_date: Date.parse("1983-10-12"), phone_number: "415-888-0088")
- expect(page).to have_text I18n.t('views.questions.personal_info.title')
- fill_in I18n.t('views.questions.personal_info.preferred_name'), with: name
- select birth_date.strftime("%B"), from: "personal_info_form[birth_date_month]"
- select birth_date.day, from: "personal_info_form[birth_date_day]"
- select birth_date.year, from: "personal_info_form[birth_date_year]"
- fill_in I18n.t('views.questions.personal_info.zip_code'), with: zip_code
- fill_in I18n.t('views.questions.personal_info.phone_number'), with: phone_number
- fill_in I18n.t('views.questions.personal_info.phone_number_confirmation'), with: phone_number
- click_on I18n.t('general.continue')
- end
-
- def complete_intake_through_code_verification(
- primary_first_name: "Gary",
- primary_middle_initial: "H",
- primary_last_name: "Mango",
- primary_birth_date: Date.parse('1996-08-24'),
- primary_email: "mango@example.com",
- primary_ssn: "111-22-8888",
- sms_phone_number: "831-234-5678",
- claim_eitc: false
- )
- visit "/en/questions/overview"
- expect(page).to have_selector(".toolbar", text: "GetCTC") # Check for appropriate header
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.overview.title'))
- click_on I18n.t('general.continue')
-
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.main_home.title', current_tax_year: MultiTenantService.new(:ctc).current_tax_year))
- choose I18n.t('views.ctc.questions.main_home.options.fifty_states')
- click_on I18n.t('general.continue')
-
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.filing_status.title', current_tax_year: MultiTenantService.new(:ctc).current_tax_year))
- click_on I18n.t('general.negative')
-
- expect(page).to have_selector(".toolbar", text: "GetCTC")
- expect(page).to have_text(I18n.t("views.ctc.questions.income_qualifier.subtitle"))
- click_on I18n.t('general.affirmative')
- click_on I18n.t('general.continue')
- click_on I18n.t("views.ctc.questions.file_full_return.simplified_btn")
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.claim_eitc.title'))
- click_on claim_eitc ? I18n.t('views.ctc.questions.claim_eitc.buttons.claim') : I18n.t('views.ctc.questions.claim_eitc.buttons.dont_claim')
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.restrictions.title'))
- click_on I18n.t('general.continue')
-
- # =========== ELIGIBILITY ===========
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.already_filed.title', current_tax_year: MultiTenantService.new(:ctc).current_tax_year))
- click_on I18n.t('general.negative')
-
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.life_situations.title', current_tax_year: MultiTenantService.new(:ctc).current_tax_year))
- click_on I18n.t('general.negative')
-
- # =========== BASIC INFO ===========
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.legal_consent.title'))
- fill_in I18n.t('views.ctc.questions.legal_consent.first_name'), with: primary_first_name
- fill_in I18n.t('views.ctc.questions.legal_consent.middle_initial'), with: primary_middle_initial
- fill_in I18n.t('views.ctc.questions.legal_consent.last_name'), with: primary_last_name
- fill_in "ctc_legal_consent_form_primary_birth_date_month", with: primary_birth_date.month
- fill_in "ctc_legal_consent_form_primary_birth_date_day", with: primary_birth_date.day
- fill_in "ctc_legal_consent_form_primary_birth_date_year", with: primary_birth_date.year
- fill_in I18n.t('views.ctc.questions.legal_consent.ssn'), with: primary_ssn
- fill_in I18n.t('views.ctc.questions.legal_consent.ssn_confirmation'), with: primary_ssn
- fill_in I18n.t('views.ctc.questions.legal_consent.sms_phone_number'), with: sms_phone_number
- check "agree_to_privacy_policy"
- click_on I18n.t('general.continue')
-
- prior_tax_year = MultiTenantService.new(:ctc).prior_tax_year
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.filed_prior_tax_year.title', prior_tax_year: prior_tax_year))
- choose I18n.t('views.ctc.questions.filed_prior_tax_year.did_not_file', prior_tax_year: prior_tax_year)
- click_on I18n.t('general.continue')
-
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.contact_preference.title'))
- click_on I18n.t('views.ctc.questions.contact_preference.email')
- expect(page).to have_selector("h1", text: I18n.t('views.ctc.questions.email_address.title'))
- fill_in I18n.t('views.questions.email_address.email_address'), with: primary_email
- fill_in I18n.t('views.questions.email_address.email_address_confirmation'), with: primary_email
- click_on I18n.t('general.continue')
-
- expect(page).to have_selector("p", text: I18n.t('views.ctc.questions.verification.body').strip)
-
- perform_enqueued_jobs
- mail = ActionMailer::Base.deliveries.last
- code = mail.html_part.body.to_s.match(/\s(\d{6})[.]/)[1]
-
- fill_in I18n.t('views.ctc.questions.verification.verification_code_label'), with: "000001"
- click_on I18n.t("views.ctc.questions.verification.verify")
- expect(page).to have_content(I18n.t('views.ctc.questions.verification.error_message'))
-
- fill_in I18n.t('views.ctc.questions.verification.verification_code_label'), with: code
- click_on I18n.t("views.ctc.questions.verification.verify")
- end
-end