Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NJ 271 - fix when review screen displays health insurance section #5457

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case would never happen as someone with no exceptions and who answered no to the eligibility question would be screened out.

if self.eligibility_all_members_health_insurance_no? && !self.has_health_insurance_requirement_exception?

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_no_deps }

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pebble] - I think if we have this test, we should pair it with a test case for the opposite when we do expect the text

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
13 changes: 5 additions & 8 deletions spec/factories/state_file_nj_intakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@

after(:build) do |intake, evaluator|
intake.municipality_code = "0101"
numeric_status = {
single: 1,
married_filing_jointly: 2,
married_filing_separately: 3,
head_of_household: 4,
qualifying_widow: 5,
}[evaluator.filing_status.to_sym] || evaluator.filing_status
intake.direct_file_data.filing_status = numeric_status
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code would always override filing status to be single

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this issue to a separate ticket: https://github.com/newjersey/affordability-pm/issues/279. Going to revert the logic for now, and use a persona with filing_status single (nj_lucky_single) and no dependents for the test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making that follow-up ticket!

intake.direct_file_data.primary_ssn = evaluator.primary_ssn || intake.direct_file_data.primary_ssn
intake.direct_file_data.spouse_ssn = evaluator.spouse_ssn || intake.direct_file_data.spouse_ssn
intake.raw_direct_file_data = intake.direct_file_data.to_s
Expand Down Expand Up @@ -178,6 +170,11 @@
raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nj_minimal') }
end

trait :df_data_no_deps do
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nj_springsteen_mfj') }
raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nj_springsteen_mfj') }
end

trait :df_data_many_deps do
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nj_zeus_many_deps') }
raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nj_zeus_many_deps') }
Expand Down
Loading