diff --git a/app/assets/stylesheets/_state-file.scss b/app/assets/stylesheets/_state-file.scss index c1655a7bbe..682adf4679 100644 --- a/app/assets/stylesheets/_state-file.scss +++ b/app/assets/stylesheets/_state-file.scss @@ -312,19 +312,6 @@ font-size: 1.3rem; line-height: 1.9rem; } - - &.grey-group { - margin: 0 auto; - padding: 2rem; - margin-bottom: 2rem; - background: $color-grey-light; - border: 2px solid $color-grey-medium-light; - border-radius: 6px; - - .checkbox.is-selected { - background: inherit; - } - } } .form1099__label { diff --git a/app/controllers/state_file/questions/nj_dependents_health_insurance_controller.rb b/app/controllers/state_file/questions/nj_dependents_health_insurance_controller.rb new file mode 100644 index 0000000000..462cdc3db6 --- /dev/null +++ b/app/controllers/state_file/questions/nj_dependents_health_insurance_controller.rb @@ -0,0 +1,26 @@ +module StateFile + module Questions + class NjDependentsHealthInsuranceController < QuestionsController + + before_action -> { @filing_year = Rails.configuration.statefile_current_tax_year } + + def self.show?(intake) + return false unless intake.dependents.any? + intake.has_health_insurance_requirement_exception? || intake.eligibility_all_members_health_insurance_no? + end + + def form_params + params + .fetch(:state_file_nj_dependents_health_insurance_form, {}) + .permit([ + { + dependents_attributes: [ + :id, + :nj_did_not_have_health_insurance, + ] + } + ]) + end + end + end +end \ No newline at end of file diff --git a/app/controllers/state_file/questions/nj_eligibility_health_insurance_controller.rb b/app/controllers/state_file/questions/nj_eligibility_health_insurance_controller.rb index ce85f1f0da..aa47417c67 100644 --- a/app/controllers/state_file/questions/nj_eligibility_health_insurance_controller.rb +++ b/app/controllers/state_file/questions/nj_eligibility_health_insurance_controller.rb @@ -5,19 +5,16 @@ class NjEligibilityHealthInsuranceController < QuestionsController before_action -> { @filing_year = Rails.configuration.statefile_current_tax_year } + def self.show?(intake) + !intake.has_health_insurance_requirement_exception? + end + def form_params params .fetch(:state_file_nj_eligibility_health_insurance_form, {}) - .permit([ - :eligibility_all_members_health_insurance, - { - dependents_attributes: [ - :id, - :nj_did_not_have_health_insurance, - ] - } - ]) + .permit([:eligibility_all_members_health_insurance]) end + end end end \ No newline at end of file diff --git a/app/forms/state_file/nj_dependents_health_insurance_form.rb b/app/forms/state_file/nj_dependents_health_insurance_form.rb new file mode 100644 index 0000000000..f7e7cb2bc8 --- /dev/null +++ b/app/forms/state_file/nj_dependents_health_insurance_form.rb @@ -0,0 +1,10 @@ +module StateFile + class NjDependentsHealthInsuranceForm < QuestionsForm + attr_accessor :dependents_attributes + delegate :dependents, to: :intake + + def save + @intake.update!(dependents_attributes: dependents_attributes.to_h) + end + end +end \ No newline at end of file diff --git a/app/forms/state_file/nj_eligibility_health_insurance_form.rb b/app/forms/state_file/nj_eligibility_health_insurance_form.rb index 5329f724c0..679c93e53d 100644 --- a/app/forms/state_file/nj_eligibility_health_insurance_form.rb +++ b/app/forms/state_file/nj_eligibility_health_insurance_form.rb @@ -1,21 +1,11 @@ module StateFile class NjEligibilityHealthInsuranceForm < QuestionsForm set_attributes_for :intake, :eligibility_all_members_health_insurance - attr_accessor :dependents_attributes - delegate :dependents, to: :intake validates :eligibility_all_members_health_insurance, presence: true def save @intake.update(attributes_for(:intake)) - if @intake.eligibility_all_members_health_insurance_no? - @intake.update!(dependents_attributes: dependents_attributes.to_h) - else - attributes_array = intake.dependents.map do |dependent| - { id: dependent.id, nj_did_not_have_health_insurance: 'no' } - end - @intake.update!(dependents_attributes: attributes_array) - end end end end \ No newline at end of file diff --git a/app/lib/navigation/state_file_nj_question_navigation.rb b/app/lib/navigation/state_file_nj_question_navigation.rb index f09752d232..11ae5c28c3 100644 --- a/app/lib/navigation/state_file_nj_question_navigation.rb +++ b/app/lib/navigation/state_file_nj_question_navigation.rb @@ -39,6 +39,7 @@ class StateFileNjQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio Navigation::NavigationStep.new(StateFile::Questions::NjDisabledExemptionController), Navigation::NavigationStep.new(StateFile::Questions::NjVeteransExemptionController), Navigation::NavigationStep.new(StateFile::Questions::NjCollegeDependentsExemptionController), + Navigation::NavigationStep.new(StateFile::Questions::NjDependentsHealthInsuranceController), Navigation::NavigationStep.new(StateFile::Questions::NjMedicalExpensesController), Navigation::NavigationStep.new(StateFile::Questions::NjHouseholdRentOwnController), Navigation::NavigationStep.new(StateFile::Questions::NjHomeownerEligibilityController), diff --git a/app/models/state_file_nj_intake.rb b/app/models/state_file_nj_intake.rb index dfe113af8b..eae3b1c00a 100644 --- a/app/models/state_file_nj_intake.rb +++ b/app/models/state_file_nj_intake.rb @@ -184,13 +184,15 @@ def eligibility_made_less_than_threshold? nj_gross_income <= threshold end + def has_health_insurance_requirement_exception? + self.eligibility_made_less_than_threshold? || self.eligibility_claimed_as_dependent? + end + def health_insurance_eligibility - if self.eligibility_all_members_health_insurance_no? - has_exception = self.eligibility_made_less_than_threshold? || self.eligibility_claimed_as_dependent? - has_exception ? "eligible" : "ineligible" - else - "eligible" + if self.eligibility_all_members_health_insurance_no? && !self.has_health_insurance_requirement_exception? + return "ineligible" end + "eligible" end def disqualifying_eligibility_rules diff --git a/app/views/state_file/questions/nj_dependents_health_insurance/edit.html.erb b/app/views/state_file/questions/nj_dependents_health_insurance/edit.html.erb new file mode 100644 index 0000000000..d0dab47c56 --- /dev/null +++ b/app/views/state_file/questions/nj_dependents_health_insurance/edit.html.erb @@ -0,0 +1,34 @@ +<% title = t(".title_html") %> + +<% content_for :page_title, title %> +<% content_for :card do %> +

<%= title %>

+ + <%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %> +
+
+ <%= t('.label') %> +
+ <%= f.fields_for :dependents do |ff| %> + <% dependent = ff.object %> + <%= ff.cfa_checkbox( + :nj_did_not_have_health_insurance, + dependent.full_name, + options: { checked_value: "yes", unchecked_value: "no" } + ) %> + <% end %> +
+
+
+ +

<%= t('.continue') %>

+
+ +
+ <%= t('state_file.general.nj_minimal_essential_health_coverage_html') %> +
+
+ + <%= f.continue %> + <% end %> +<% end %> diff --git a/app/views/state_file/questions/nj_eligibility_health_insurance/edit.html.erb b/app/views/state_file/questions/nj_eligibility_health_insurance/edit.html.erb index 4fa1561175..56ae021441 100644 --- a/app/views/state_file/questions/nj_eligibility_health_insurance/edit.html.erb +++ b/app/views/state_file/questions/nj_eligibility_health_insurance/edit.html.erb @@ -6,49 +6,29 @@ <%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
-
-
- <%= f.cfa_radio_set( - :eligibility_all_members_health_insurance, - label_text: t(".label", filing_year: @filing_year), - collection: [ - { value: "yes", label: t("general.affirmative") }, - { - value: "no", - label: t("general.negative"), - input_html: { - "data-follow-up": "#household-members", - "aria-controls": "household-members" - } - }, - ], - ) %> +
+ <%= f.cfa_radio_set( + :eligibility_all_members_health_insurance, + label_text: t(".label", filing_year: @filing_year), + collection: [ + { value: "yes", label: t("general.affirmative") }, + { + value: "no", + label: t("general.negative"), + input_html: { + "data-follow-up": "#household-members", + "aria-controls": "household-members" + } + }, + ], + ) %>
- - <% if current_intake.dependents.any? %> - - <% end %> -
-

<%= t('.coverage_description_html') %>

+ <%= t('state_file.general.nj_minimal_essential_health_coverage_html') %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index f7b49ba628..1de35d888f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2119,6 +2119,16 @@ en: nc_tax_withheld: North Carolina tax withheld nc_taxable_income: North Carolina taxable income nc_use_tax: North Carolina use tax + nj_minimal_essential_health_coverage_html: |- +

Most people who have health insurance have minimum essential coverage. “Minimal essential coverage” just refers to how much your plan covers. If you have any of the following, you most likely have it:

+ +

Here is the full list of insurance options that have minimum essential coverage.

+

If you only had standalone vision and dental plans, workers' compensation coverage, and/or coverage limited to a specified disease or illness, you didn't have minimum essential coverage. In New Jersey, as of 2018, you need minimum essential coverage, or you will likely pay additional taxes.

register_to_vote: Register to vote. see_detailed_return: See detailed return information standard_deduction: Standard deduction @@ -3127,6 +3137,12 @@ en: edit: county: County title: Select the county where you lived on December 31, %{filing_year} + nj_dependents_health_insurance: + edit: + continue: Click "continue" if all these people had health insurance. + coverage_heading: What is health insurance with minimum essential coverage? + label: 'Check all the people that did NOT have health insurance:' + title_html: Please tell us which dependents were missing health insurance (with minimum essential health coverage) in 2024. nj_disabled_exemption: edit: instructions_html: People with disabilities are eligible for tax exemptions.

In NJ, you are considered disabled if you have a "total and permanent inability to engage in any substantial gainful activity because of any physical or mental impairment, including blindness."

(This is different from the federal tax definition. NJ doesn’t consider your age or your receipt of taxable disability income.) @@ -3160,11 +3176,8 @@ en: title: You may be eligible for the Earned Income Tax Credit nj_eligibility_health_insurance: edit: - coverage_description_html: "

Most people who have health insurance have minimum essential coverage. “Minimal essential coverage” just refers to how much your plan covers. If you have any of the following, you most likely have it:

\n\n

Here is the full list of insurance options that have minimum essential coverage.

\n

If you only had standalone vision and dental plans, workers' compensation coverage, and/or coverage limited to a specified disease or illness, you didn't have minimum essential coverage. In New Jersey, as of 2018, you need minimum essential coverage, or you will likely pay additional taxes.

\n" coverage_heading: What is health insurance with minimum essential coverage? - dependent_label: "%{name}" label: Did you and all members of your tax household have health insurance (with minimum essential coverage) for every month in %{filing_year}? - label_follow_up: Which dependents were missing health insurance? tax_household_description_html: A tax household includes you, your spouse (if filing a joint return), domestic partner claimed on your return, and any individuals you claim as dependents on your NJ-1040. It also includes any individuals you can, but do not, claim as dependents on your return. tax_household_heading: What is considered a tax household? title: Let’s get started. diff --git a/config/locales/es.yml b/config/locales/es.yml index 98c5145903..419ccb0729 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -2071,6 +2071,16 @@ es: nc_tax_withheld: Impuesto retenido en Carolina del Norte nc_taxable_income: Ingreso tributables en Carolina del Norte nc_use_tax: Impuesto sobre el uso de Carolina del Norte + nj_minimal_essential_health_coverage_html: |- +

Most people who have health insurance have minimum essential coverage. “Minimal essential coverage” just refers to how much your plan covers. If you have any of the following, you most likely have it:

+ +

Here is the full list of insurance options that have minimum essential coverage.

+

If you only had standalone vision and dental plans, workers' compensation coverage, and/or coverage limited to a specified disease or illness, you didn't have minimum essential coverage. In New Jersey, as of 2018, you need minimum essential coverage, or you will likely pay additional taxes.

register_to_vote: Regístrate para votar see_detailed_return: Ver información detallada de la declaración standard_deduction: Deducción estándar @@ -3087,6 +3097,12 @@ es: edit: county: Condado title: Selecciona el condado donde viviste el 31 de diciembre de %{filing_year} + nj_dependents_health_insurance: + edit: + continue: Click "continue" if all these people had health insurance. + coverage_heading: What is health insurance with minimum essential coverage? + label: 'Check all the people that did NOT have health insurance:' + title_html: Please tell us which dependents were missing health insurance (with minimum essential health coverage) in 2024. nj_disabled_exemption: edit: instructions_html: Las personas con discapacidad tienen derecho a exenciones de impuestos.

En Nueva Jersey, se le considera discapacitado si tiene una "incapacidad total y permanente para participar en cualquier actividad sustancial y lucrativa debido a cualquier impedimento físico o mental, incluida la ceguera".

(Esto es diferente de la definición de impuestos federales. Nueva Jersey no tiene en cuenta su edad ni su percepción de ingresos por discapacidad sujetos a impuestos.) @@ -3120,11 +3136,8 @@ es: title: You may be eligible for the Earned Income Tax Credit nj_eligibility_health_insurance: edit: - coverage_description_html: "

Most people who have health insurance have minimum essential coverage. “Minimal essential coverage” just refers to how much your plan covers. If you have any of the following, you most likely have it:

\n\n

Here is the full list of insurance options that have minimum essential coverage.

\n

If you only had standalone vision and dental plans, workers' compensation coverage, and/or coverage limited to a specified disease or illness, you didn't have minimum essential coverage. In New Jersey, as of 2018, you need minimum essential coverage, or you will likely pay additional taxes.

\n" coverage_heading: What is health insurance with minimum essential coverage? - dependent_label: "%{name}" label: Did you and all members of your tax household have health insurance (with minimum essential coverage) for every month in %{filing_year}? - label_follow_up: Which dependents were missing health insurance? tax_household_description_html: A tax household includes you, your spouse (if filing a joint return), domestic partner claimed on your return, and any individuals you claim as dependents on your NJ-1040. It also includes any individuals you can, but do not, claim as dependents on your return. tax_household_heading: What is considered a tax household? title: Let’s get started. diff --git a/spec/controllers/state_file/questions/nj_dependents_health_insurance_controller_spec.rb b/spec/controllers/state_file/questions/nj_dependents_health_insurance_controller_spec.rb new file mode 100644 index 0000000000..fb827680a7 --- /dev/null +++ b/spec/controllers/state_file/questions/nj_dependents_health_insurance_controller_spec.rb @@ -0,0 +1,90 @@ +require 'rails_helper' + +RSpec.describe StateFile::Questions::NjDependentsHealthInsuranceController do + describe ".show?" do + context "when intake has no dependents but would otherwise meet the criteria to show the controller" do + let(:intake) { create :state_file_nj_intake, :df_data_minimal} + it "does not show" do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return(true) + allow_any_instance_of(StateFileNjIntake).to receive(:eligibility_all_members_health_insurance_no?).and_return(true) + expect(described_class.show?(intake)).to eq false + end + end + + context "when intake has dependents" do + let(:intake) { create :state_file_nj_intake, :df_data_two_deps } + + context "and did not have a health insurance requirement exception and all members had health insurance" do + it "does not show" do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return(false) + allow_any_instance_of(StateFileNjIntake).to receive(:eligibility_all_members_health_insurance_no?).and_return(false) + expect(described_class.show?(intake)).to eq false + end + end + + context "and had a health insurance requirement exception, and all members had health insurance" do + it "shows" do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return(true) + allow_any_instance_of(StateFileNjIntake).to receive(:eligibility_all_members_health_insurance_no?).and_return(false) + expect(described_class.show?(intake)).to eq true + end + end + + context "and did not have a health insurance requirement exception, but all members did not have health insurance" do + it "shows" do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return(false) + allow_any_instance_of(StateFileNjIntake).to receive(:eligibility_all_members_health_insurance_no?).and_return(true) + expect(described_class.show?(intake)).to eq true + end + end + end + end + + describe "#update" do + context "taxpayer with dependents" do + let(:intake) { create :state_file_nj_intake, :df_data_two_deps } + let(:first_dependent) { intake.dependents[0] } + let(:second_dependent) { intake.dependents[1] } + + let(:form_params) do + { + state_file_nj_dependents_health_insurance_form: { + dependents_attributes: { + '0': { + id: first_dependent.id, + nj_did_not_have_health_insurance: 'yes' + }, + '1': { + id: second_dependent.id, + nj_did_not_have_health_insurance: 'no' + } + } + } + } + end + + before do + sign_in intake + end + + render_views + it "succeeds" do + get :edit + expect(response).to be_successful + end + + it "shows all dependents" do + get :edit + expect(response.body).to include("Aphrodite") + expect(response.body).to include("Kronos") + end + + it "saves the checkbox selections" do + post :update, params: form_params + intake.reload + expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "yes" + expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" + end + end + end +end \ No newline at end of file diff --git a/spec/controllers/state_file/questions/nj_eligibility_health_insurance_controller_spec.rb b/spec/controllers/state_file/questions/nj_eligibility_health_insurance_controller_spec.rb index 53a163adc4..4826a3634c 100644 --- a/spec/controllers/state_file/questions/nj_eligibility_health_insurance_controller_spec.rb +++ b/spec/controllers/state_file/questions/nj_eligibility_health_insurance_controller_spec.rb @@ -36,91 +36,5 @@ expect(response).not_to redirect_to(controller: "state_file/questions/eligibility_offboarding", action: :edit) end end - - context "when taxpayer with dependents checks no" do - let(:intake) { create :state_file_nj_intake, :df_data_two_deps } - let(:first_dependent) { intake.dependents[0] } - let(:second_dependent) { intake.dependents[1] } - - let(:form_params) do - { - state_file_nj_eligibility_health_insurance_form: { - eligibility_all_members_health_insurance: "no", - dependents_attributes: { - '0': { - id: first_dependent.id, - nj_did_not_have_health_insurance: 'yes' - }, - '1': { - id: second_dependent.id, - nj_did_not_have_health_insurance: 'no' - } - } - } - } - end - - before do - sign_in intake - end - - render_views - it "succeeds" do - get :edit - expect(response).to be_successful - end - - it "shows all dependents" do - get :edit - expect(response.body).to include("Aphrodite") - expect(response.body).to include("Kronos") - end - - it "saves the checkbox selections" do - post :update, params: form_params - intake.reload - expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "yes" - expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" - end - end - - - context "when taxpayer with dependents affirms coverage when answer was previously no and they had indicated dependents without coverage" do - let(:intake) { create :state_file_nj_intake, :df_data_two_deps, eligibility_all_members_health_insurance: 'no' } - let(:first_dependent) { intake.dependents[0] } - let(:second_dependent) { intake.dependents[1] } - - let(:form_params) do - { - state_file_nj_eligibility_health_insurance_form: { - eligibility_all_members_health_insurance: "yes", - dependents_attributes: { - '0': { - id: first_dependent.id, - nj_did_not_have_health_insurance: 'yes' - }, - '1': { - id: second_dependent.id, - nj_did_not_have_health_insurance: 'yes' - } - } - } - } - end - - before do - sign_in intake - end - - it "sets all dependent values to no to indicate that they did indeed have coverage" do - first_dependent.nj_did_not_have_health_insurance = 'no' - second_dependent.nj_did_not_have_health_insurance = 'yes' - intake.reload - post :update, params: form_params - intake.reload - expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "no" - expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" - end - end end end \ No newline at end of file diff --git a/spec/factories/state_file_nj_intakes.rb b/spec/factories/state_file_nj_intakes.rb index 9f8a54413a..96a3bb63e2 100644 --- a/spec/factories/state_file_nj_intakes.rb +++ b/spec/factories/state_file_nj_intakes.rb @@ -154,7 +154,7 @@ intake.synchronize_df_w2s_to_database intake.synchronize_df_dependents_to_database intake.dependents.each_with_index do |dependent, i| - dependent.update(dob: i.years.ago) + dependent.update(dob: Date.new(MultiTenantService.new(:statefile).current_tax_year - i, 1, 1)) end end diff --git a/spec/features/state_file/complete_intake_spec.rb b/spec/features/state_file/complete_intake_spec.rb index ba58b76717..fbe00fdc6f 100644 --- a/spec/features/state_file/complete_intake_spec.rb +++ b/spec/features/state_file/complete_intake_spec.rb @@ -677,7 +677,9 @@ def advance_to_start_of_intake(df_persona_name) expect(page).to have_text I18n.t("state_file.questions.income_review.edit.title") continue + end + def advance_health_insurance_eligibility expect(page).to have_text I18n.t("state_file.questions.nj_eligibility_health_insurance.edit.title") choose I18n.t("general.affirmative") continue @@ -775,8 +777,9 @@ def expect_ineligible_page(property, reason) continue end - def advance_to_property_tax_page(df_persona_name) + def advance_to_property_tax_page(df_persona_name, skip_health_insurance_eligibility: false) advance_to_start_of_intake(df_persona_name) + advance_health_insurance_eligibility unless skip_health_insurance_eligibility advance_county_and_municipality advance_disabled_exemption advance_veterans_exemption @@ -785,7 +788,7 @@ def advance_to_property_tax_page(df_persona_name) it "advances past the loading screen by listening for an actioncable broadcast", required_schema: "nj" do - advance_to_property_tax_page("Minimal") + advance_to_property_tax_page("Minimal", skip_health_insurance_eligibility: true) choose_household_rent_own("neither") # estimated tax payments diff --git a/spec/forms/state_file/nj_dependents_health_insurance_form_spec.rb b/spec/forms/state_file/nj_dependents_health_insurance_form_spec.rb new file mode 100644 index 0000000000..7376bd4ddd --- /dev/null +++ b/spec/forms/state_file/nj_dependents_health_insurance_form_spec.rb @@ -0,0 +1,37 @@ +require 'rails_helper' + +RSpec.describe StateFile::NjDependentsHealthInsuranceForm do + let(:intake) { + create :state_file_nj_intake, + :df_data_two_deps + } + let(:first_dependent) { intake.dependents[0] } + let(:second_dependent) { intake.dependents[1] } + + describe "#save" do + context "when not all dependents had health insurance" do + let(:valid_params) do + { + dependents_attributes: { + '0': { + id: first_dependent.id, + nj_did_not_have_health_insurance: 'yes' + }, + '1': { + id: second_dependent.id, + nj_did_not_have_health_insurance: 'no' + } + } + } + end + + it "saves the answers to the intake" do + form = described_class.new(intake, valid_params) + form.save + intake.reload + expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "yes" + expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" + end + end + end +end \ No newline at end of file diff --git a/spec/forms/state_file/nj_eligibility_health_insurance_form_spec.rb b/spec/forms/state_file/nj_eligibility_health_insurance_form_spec.rb index d02f976d21..17115724a7 100644 --- a/spec/forms/state_file/nj_eligibility_health_insurance_form_spec.rb +++ b/spec/forms/state_file/nj_eligibility_health_insurance_form_spec.rb @@ -3,11 +3,8 @@ RSpec.describe StateFile::NjEligibilityHealthInsuranceForm do let(:intake) { create :state_file_nj_intake, - :df_data_two_deps, eligibility_all_members_health_insurance: "unfilled" } - let(:first_dependent) { intake.dependents[0] } - let(:second_dependent) { intake.dependents[1] } describe "validations" do let(:invalid_params) do @@ -27,16 +24,6 @@ let(:valid_params) do { eligibility_all_members_health_insurance: "yes", - dependents_attributes: { - '0': { - id: first_dependent.id, - nj_did_not_have_health_insurance: 'yes' - }, - '1': { - id: second_dependent.id, - nj_did_not_have_health_insurance: 'no' - } - } } end @@ -46,30 +33,12 @@ intake.reload expect(intake.eligibility_all_members_health_insurance_yes?).to eq true end - - it "saves no for all dependents" do - form = described_class.new(intake, valid_params) - form.save - intake.reload - expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "no" - expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" - end end context "when not all tax household members had health insurance" do let(:valid_params) do { eligibility_all_members_health_insurance: "no", - dependents_attributes: { - '0': { - id: first_dependent.id, - nj_did_not_have_health_insurance: 'yes' - }, - '1': { - id: second_dependent.id, - nj_did_not_have_health_insurance: 'no' - } - } } end @@ -78,8 +47,6 @@ form.save intake.reload expect(intake.eligibility_all_members_health_insurance_yes?).to eq false - expect(intake.dependents[0].nj_did_not_have_health_insurance).to eq "yes" - expect(intake.dependents[1].nj_did_not_have_health_insurance).to eq "no" end end end diff --git a/spec/lib/pdf_filler/nj_additional_dependents_pdf_spec.rb b/spec/lib/pdf_filler/nj_additional_dependents_pdf_spec.rb index 09bfe96628..bda0976386 100644 --- a/spec/lib/pdf_filler/nj_additional_dependents_pdf_spec.rb +++ b/spec/lib/pdf_filler/nj_additional_dependents_pdf_spec.rb @@ -30,34 +30,36 @@ end it 'fills dependents from XML after index 4 into the PDF' do + tax_year = MultiTenantService.new(:statefile).current_tax_year + expect(pdf_fields["Name_Row1"]).to eq "Underworld Hades" expect(pdf_fields["SSN_Row1"]).to eq "300000027" - expect(pdf_fields["BirthYear_Row1"]).to eq "#{4.years.ago.year}" + expect(pdf_fields["BirthYear_Row1"]).to eq (tax_year - 4).to_s expect(pdf_fields["HealthInsurance_Row1"]).to eq "Yes" expect(pdf_fields["Name_Row2"]).to eq "Thunder Ares" expect(pdf_fields["SSN_Row2"]).to eq "300000022" - expect(pdf_fields["BirthYear_Row2"]).to eq "#{5.years.ago.year}" + expect(pdf_fields["BirthYear_Row2"]).to eq (tax_year - 5).to_s expect(pdf_fields["HealthInsurance_Row2"]).to eq "Off" expect(pdf_fields["Name_Row3"]).to eq "Thunder Hercules" expect(pdf_fields["SSN_Row3"]).to eq "300000065" - expect(pdf_fields["BirthYear_Row3"]).to eq "#{6.years.ago.year}" + expect(pdf_fields["BirthYear_Row3"]).to eq (tax_year - 6).to_s expect(pdf_fields["HealthInsurance_Row3"]).to eq "Yes" expect(pdf_fields["Name_Row4"]).to eq "Archer Hermes" expect(pdf_fields["SSN_Row4"]).to eq "300000024" - expect(pdf_fields["BirthYear_Row4"]).to eq "#{7.years.ago.year}" + expect(pdf_fields["BirthYear_Row4"]).to eq (tax_year - 7).to_s expect(pdf_fields["HealthInsurance_Row4"]).to eq "Off" expect(pdf_fields["Name_Row5"]).to eq "Thunder Hebe" expect(pdf_fields["SSN_Row5"]).to eq "300000023" - expect(pdf_fields["BirthYear_Row5"]).to eq "#{8.years.ago.year}" + expect(pdf_fields["BirthYear_Row5"]).to eq (tax_year - 8).to_s expect(pdf_fields["HealthInsurance_Row5"]).to eq "Yes" expect(pdf_fields["Name_Row6"]).to eq "Wine Dionysus" expect(pdf_fields["SSN_Row6"]).to eq "300000068" - expect(pdf_fields["BirthYear_Row6"]).to eq "#{9.years.ago.year}" + expect(pdf_fields["BirthYear_Row6"]).to eq (tax_year - 9).to_s expect(pdf_fields["HealthInsurance_Row6"]).to eq "Off" end end diff --git a/spec/lib/submission_builder/ty2024/states/nj/nj_return_xml_spec.rb b/spec/lib/submission_builder/ty2024/states/nj/nj_return_xml_spec.rb index 4ae376b248..320a5b27fa 100644 --- a/spec/lib/submission_builder/ty2024/states/nj/nj_return_xml_spec.rb +++ b/spec/lib/submission_builder/ty2024/states/nj/nj_return_xml_spec.rb @@ -73,7 +73,7 @@ expect(xml.document.at('Dependents DependentsName FirstName').text).to eq("Kronos") expect(xml.document.at('Dependents DependentsName LastName').text).to eq("Athens") expect(xml.document.at('Dependents DependentsSSN').text).to eq("300000029") - expect(xml.document.at('Dependents BirthYear').text).to eq(Time.now.year.to_s) + expect(xml.document.at('Dependents BirthYear').text).to eq(MultiTenantService.new(:statefile).current_tax_year.to_s) end end diff --git a/spec/models/efile_error_spec.rb b/spec/models/efile_error_spec.rb index 7a8fcc6200..eebc0d5936 100644 --- a/spec/models/efile_error_spec.rb +++ b/spec/models/efile_error_spec.rb @@ -81,6 +81,7 @@ "nc-veteran-status", "nj-college-dependents-exemption", "nj-county", + "nj-dependents-health-insurance", "nj-disabled-exemption", "nj-eitc-qualifying-child", "nj-eligibility-health-insurance", diff --git a/spec/models/state_file_nj_intake_spec.rb b/spec/models/state_file_nj_intake_spec.rb index 631115f9a5..255af377bb 100644 --- a/spec/models/state_file_nj_intake_spec.rb +++ b/spec/models/state_file_nj_intake_spec.rb @@ -193,7 +193,7 @@ shared_examples :eligibility_with_threshold do |threshold| it "returns true if NJ gross income below #{threshold}" do - allow(intake.calculator.lines).to receive(:[]).with(:NJ1040_LINE_29).and_return(double(value: threshold-1)) + allow(intake.calculator.lines).to receive(:[]).with(:NJ1040_LINE_29).and_return(double(value: threshold - 1)) expect(intake.eligibility_made_less_than_threshold?).to eq true end @@ -203,7 +203,7 @@ end it "returns false if NJ gross income over #{threshold}" do - allow(intake.calculator.lines).to receive(:[]).with(:NJ1040_LINE_29).and_return(double(value: threshold+1)) + allow(intake.calculator.lines).to receive(:[]).with(:NJ1040_LINE_29).and_return(double(value: threshold + 1)) expect(intake.eligibility_made_less_than_threshold?).to eq false end end