From a4dacdea866fea60f001d91909d307658109c857 Mon Sep 17 00:00:00 2001 From: John Chan Date: Wed, 29 Jan 2025 13:04:49 -0500 Subject: [PATCH] NJ 271 - fix when review screen displays health insurance section (#5457) * NJ 271 - fix when review screen displays health insurance section * Simplify display logic * Fix bug in intake that causes filing status to be incorrect * change no dependents persona to nj_lucky_single * forgot to add updated factory in last commit --- ..._dependents_health_insurance_controller.rb | 3 +- .../questions/nj_review/edit.html.erb | 2 +- ...ndents_health_insurance_controller_spec.rb | 8 ---- .../questions/nj_review_controller_spec.rb | 39 +++++++++++++++++++ 4 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 spec/controllers/state_file/questions/nj_review_controller_spec.rb 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 index 7b64fcccd1..6c557529d7 100644 --- a/app/controllers/state_file/questions/nj_dependents_health_insurance_controller.rb +++ b/app/controllers/state_file/questions/nj_dependents_health_insurance_controller.rb @@ -4,8 +4,7 @@ class NjDependentsHealthInsuranceController < QuestionsController include ReturnToReviewConcern def self.show?(intake) - return false unless intake.dependents.any? - intake.has_health_insurance_requirement_exception? || intake.eligibility_all_members_health_insurance_no? + intake.dependents.any? && intake.has_health_insurance_requirement_exception? end def form_params diff --git a/app/views/state_file/questions/nj_review/edit.html.erb b/app/views/state_file/questions/nj_review/edit.html.erb index 3b43bcfd9e..2fe5d54522 100644 --- a/app/views/state_file/questions/nj_review/edit.html.erb +++ b/app/views/state_file/questions/nj_review/edit.html.erb @@ -23,7 +23,7 @@ <% end %> - <% if current_intake.has_health_insurance_requirement_exception? || current_intake.eligibility_all_members_health_insurance_no? %> + <% if current_intake.dependents.any? && current_intake.has_health_insurance_requirement_exception? %>

<%=t(".missing_health_insurance") %>

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 index fb827680a7..c1d5501a3b 100644 --- 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 @@ -29,14 +29,6 @@ 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 diff --git a/spec/controllers/state_file/questions/nj_review_controller_spec.rb b/spec/controllers/state_file/questions/nj_review_controller_spec.rb new file mode 100644 index 0000000000..30c6357120 --- /dev/null +++ b/spec/controllers/state_file/questions/nj_review_controller_spec.rb @@ -0,0 +1,39 @@ +require "rails_helper" + +RSpec.describe StateFile::Questions::NjReviewController do + before do + sign_in intake + end + + describe "#edit" do + render_views + context 'when no dependents' do + let(:intake) { create :state_file_nj_intake, :df_data_box_14 } + + it 'does not show the dependents without health insurance block' do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return false + get :edit + expect(response.body).not_to have_text "Dependents who DO NOT have health insurance" + end + end + + context 'when taxpayer has dependents' do + let(:intake) { create :state_file_nj_intake, :df_data_qss } + context 'when taxpayer does not have health insurance exception' do + it 'does not show the dependents without health insurance block' do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return false + get :edit + expect(response.body).not_to have_text "Dependents who DO NOT have health insurance" + end + end + + context 'when taxpayer does have health insurance exception' do + it 'shows the dependents without health insurance block' do + allow_any_instance_of(StateFileNjIntake).to receive(:has_health_insurance_requirement_exception?).and_return true + get :edit + expect(response.body).to have_text "Dependents who DO NOT have health insurance" + end + end + end + end +end \ No newline at end of file