Skip to content

Commit

Permalink
NJ 271 - fix when review screen displays health insurance section (#5457
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
jachan authored Jan 29, 2025
1 parent 40bc514 commit a4dacde
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/state_file/questions/nj_review/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</section>
<% 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? %>
<section id="missing-health-insurance" class="white-group">
<div class="spacing-below-5">
<h2 class="text--body text--bold spacing-below-5"><%=t(".missing_health_insurance") %></h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
39 changes: 39 additions & 0 deletions spec/controllers/state_file/questions/nj_review_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a4dacde

Please sign in to comment.