Skip to content

Commit e92968a

Browse files
committed
Add test changes
1 parent ea03217 commit e92968a

File tree

11 files changed

+40
-43
lines changed

11 files changed

+40
-43
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module YearSelectionHelper
22
# Year selection for separated, divorced and widowed GYR flow questions
33
def year_options_from_2018_to_current_tax_yr_plus_one
4-
#investigate
5-
(MultiTenantService.new(:gyr).current_tax_year + 1).downto(2018).map { |year| [year.to_s, year.to_s] } + [[t("general.before_2018"), "before 2018"]]
4+
(MultiTenantService.new(:gyr).current_tax_year(app_time) + 1)
5+
.downto(2018).map { |year| [year.to_s, year.to_s] } + [[t("general.before_2018"), "before 2018"]]
66
end
77
end

app/services/multi_tenant_service.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ def current_tax_year(time = DateTime.now)
9191
end
9292
end
9393

94-
def gyr_current_tax_year(time)
95-
filing_seasons = Rails.configuration.tax_year_filing_seasons.select do |key, val|
96-
# val = open, closed date
97-
time > val[0]
98-
end
99-
100-
filing_seasons.keys.max
101-
end
102-
10394
def end_of_current_tax_year
10495
DateTime.new(current_tax_year).end_of_year
10596
end
@@ -124,12 +115,6 @@ def filing_years(now = DateTime.now)
124115
years
125116
end
126117
end
127-
# not showing 2025 when we are not in 2026
128-
#
129-
130-
# latest_filing_year = MultiTenantService.new(:gyr).current_tax_year #Rails.configuration.tax_year_filing_seasons.keys.max
131-
# raise StandardError, "check year" if latest_filing_year != current_tax_year
132-
# years = [latest_filing_year, latest_filing_year - 1, latest_filing_year - 2, latest_filing_year - 3]
133118

134119
def backtax_years(now = DateTime.now)
135120
filing_years(now).without(current_tax_year)
@@ -163,4 +148,15 @@ def statefile
163148
new(:statefile)
164149
end
165150
end
151+
152+
private
153+
154+
def gyr_current_tax_year(time)
155+
filing_seasons = Rails.configuration.tax_year_filing_seasons.select do |key, val|
156+
# val = open, closed date
157+
time > val[0]
158+
end
159+
160+
filing_seasons.keys.max
161+
end
166162
end

app/views/questions/backtaxes/edit.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
MultiTenantService.gyr.current_tax_year.to_s,
3434
options: { checked_value: "yes", unchecked_value: "no" }) %>
3535
</div>
36+
<% binding.pry %>
3637

3738
<%= f.continue %>
3839
<% end %>

spec/controllers/hub/clients_controller_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,22 @@
8787
vita_partner_id: vita_partner_id,
8888
tax_returns_attributes: {
8989
"0": {
90-
year: Rails.configuration.gyr_current_tax_year.to_s,
90+
year: MultiTenantService.new(:gyr).current_tax_year.to_s,
9191
is_hsa: true,
9292
certification_level: "advanced"
9393
},
9494
"1": {
95-
year: (Rails.configuration.gyr_current_tax_year - 1).to_s,
95+
year: (MultiTenantService.new(:gyr).current_tax_year - 1).to_s,
9696
is_hsa: false,
9797
certification_level: "basic"
9898
},
9999
"2": {
100-
year: (Rails.configuration.gyr_current_tax_year - 2).to_s,
100+
year: (MultiTenantService.new(:gyr).current_tax_year - 2).to_s,
101101
is_hsa: false,
102102
certification_level: "basic"
103103
},
104104
"3": {
105-
year: (Rails.configuration.gyr_current_tax_year - 3).to_s,
105+
year: (MultiTenantService.new(:gyr).current_tax_year - 3).to_s,
106106
is_hsa: false,
107107
certification_level: "advanced"
108108
},

spec/controllers/portal/portal_controller_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
let(:client) { create :client, intake: (build :intake) }
3939

4040
before do
41-
create :tax_return, :intake_in_progress, year: (Rails.configuration.gyr_current_tax_year - 2), client: client
42-
create :tax_return, :prep_ready_for_prep, year: (Rails.configuration.gyr_current_tax_year - 1), client: client
41+
create :tax_return, :intake_in_progress, year: (MultiTenantService.new(:gyr).current_tax_year - 2), client: client
42+
create :tax_return, :prep_ready_for_prep, year: (MultiTenantService.new(:gyr).current_tax_year - 1), client: client
4343
create :gyr_tax_return, :intake_ready_for_call, client: client
4444
end
4545

@@ -52,7 +52,7 @@
5252
it "loads the client tax returns in desc order" do
5353
get :home
5454

55-
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)]
55+
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)]
5656
expect(assigns(:current_step)).to eq nil
5757
end
5858
end

spec/features/web_intake/returning_filer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
click_on I18n.t('general.continue')
3838

3939
# backtaxes
40-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
40+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
4141
click_on I18n.t('general.continue')
4242

4343
# start with current year
@@ -72,7 +72,7 @@
7272
click_on I18n.t('general.continue')
7373

7474
# backtaxes
75-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
75+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
7676
click_on I18n.t('general.continue')
7777

7878
# start with current year

spec/features/web_intake/routing_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def fill_out_notification_preferences(fill_out_optional_consent: true)
9393
click_on I18n.t('general.continue')
9494

9595
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
96-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
96+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
9797
click_on I18n.t('general.continue')
9898

9999
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)
119119
click_on I18n.t('general.continue')
120120

121121
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
122-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
122+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
123123
click_on I18n.t('general.continue')
124124

125125
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)
147147
click_on I18n.t('general.continue')
148148

149149
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
150-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
150+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
151151
click_on I18n.t('general.continue')
152152

153153
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)
181181
click_on I18n.t('general.continue')
182182

183183
expect(page).to have_text I18n.t('views.questions.backtaxes.title')
184-
check (Rails.configuration.gyr_current_tax_year - 2).to_s
184+
check (MultiTenantService.new(:gyr).current_tax_year - 2).to_s
185185
click_on I18n.t('general.continue')
186186

187187
expect(page).to have_text I18n.t('views.questions.start_with_current_year.title', year: current_tax_year)

spec/forms/hub/create_client_form_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@
6666
primary_tin_type: "ssn",
6767
tax_returns_attributes: {
6868
"0" => {
69-
year: Rails.configuration.gyr_current_tax_year.to_s,
69+
year: MultiTenantService.new(:gyr).current_tax_year.to_s,
7070
is_hsa: "1",
7171
certification_level: "basic"
7272
},
7373
"1" => {
74-
year: (Rails.configuration.gyr_current_tax_year - 1).to_s,
74+
year: (MultiTenantService.new(:gyr).current_tax_year - 1).to_s,
7575
is_hsa: "0",
7676
certification_level: "basic"
7777
},
7878
"2" => {
79-
year: (Rails.configuration.gyr_current_tax_year - 2).to_s,
79+
year: (MultiTenantService.new(:gyr).current_tax_year - 2).to_s,
8080
is_hsa: "1",
8181
certification_level: "basic"
8282
},
8383
"3" => {
84-
year: (Rails.configuration.gyr_current_tax_year - 3).to_s,
84+
year: (MultiTenantService.new(:gyr).current_tax_year - 3).to_s,
8585
is_hsa: "0",
8686
certification_level: "advanced"
8787
},
@@ -166,7 +166,7 @@
166166
expect(intake.needs_help_previous_year_3).to eq "yes"
167167
expect(intake.needs_help_previous_year_1).to eq "yes"
168168
expect(intake.needs_help_current_year).to eq "yes"
169-
current_tax_year = Rails.configuration.gyr_current_tax_year
169+
current_tax_year = MultiTenantService.new(:gyr).current_tax_year
170170
expect(tax_returns.map(&:year)).to match_array [current_tax_year, (current_tax_year - 1), (current_tax_year - 2), (current_tax_year - 3)]
171171
expect(tax_returns.map(&:client).uniq).to eq [intake.client]
172172
expect(tax_returns.map(&:service_type).uniq).to eq ["drop_off"]

spec/jobs/bulk_action_job_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@
397397
form_params: params
398398
)
399399

400-
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"
400+
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"
401401
end
402402

403403
context "when 'Keep current status' is selected" do

spec/models/intake_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,12 +764,12 @@
764764

765765
context "with a couple filing years selected" do
766766
let!(:client) { create :client, tax_returns: [
767-
build(:tax_return, year: (Rails.configuration.gyr_current_tax_year - 1)),
767+
build(:tax_return, year: (MultiTenantService.new(:gyr).current_tax_year - 1)),
768768
build(:gyr_tax_return)
769769
], intake: intake }
770770

771771
it "returns them as an array" do
772-
expect(intake.filing_years).to eq([Rails.configuration.gyr_current_tax_year, (Rails.configuration.gyr_current_tax_year - 1)])
772+
expect(intake.filing_years).to eq([MultiTenantService.new(:gyr).current_tax_year, (MultiTenantService.new(:gyr).current_tax_year - 1)])
773773
end
774774
end
775775
end

0 commit comments

Comments
 (0)