Skip to content

Commit

Permalink
general spec fixes for bootstrap upgrade (#4193)
Browse files Browse the repository at this point in the history
* family members controller spec fixes

* rspec fixes
  • Loading branch information
RyanEddyIC authored and bbodine1 committed Aug 20, 2024
1 parent 8f8c1fb commit 7931260
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 44 deletions.
8 changes: 4 additions & 4 deletions app/controllers/insured/family_members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def edit

@bs4 = true if params[:bs4] == "true"
respond_to do |format|
format.html
format.js
format.html { render 'edit.js.erb' }
format.js { render 'edit.js.erb' }
end
end

Expand Down Expand Up @@ -205,8 +205,8 @@ def update
@vlp_doc_subject = get_vlp_doc_subject_by_consumer_role(consumer_role) if consumer_role.present?
init_address_for_dependent
respond_to do |format|
format.html { render 'edit' }
format.js { render 'edit' }
format.html { render 'edit.js.erb' }
format.js { render 'edit.js.erb' }
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/views/insured/families/_family_member_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<td><%= member.age_on(TimeKeeper.date_of_record) %></td>
<td><%= member.gender.humanize %></td>
<td><%= member.relationship.try(:humanize) %></td>
<td class="p-2 <%= pundit_class Family, :updateable? %>">
<% edit_url = member.is_primary_applicant ? personal_insured_families_path({bs4: @bs4}) : main_app.edit_insured_family_member_path(member, {bs4: @bs4}) %>
<td class="p-2">
<% edit_url = member.is_primary_applicant ? personal_insured_families_path({bs4: @bs4}) : main_app.edit_insured_family_member_path({id: member.id, bs4: @bs4}) %>
<span class="d-flex">
<%= h(link_to l10n("edit_member"), edit_url, remote: true, id: "edit-member-#{person_id}", class: 'btn button outline close-2') %>
</span>
</td>
</tr>
<tr id="person-<%= person_id %>" class="hidden">
<td colspan="6" class="append_consumer_info"></td>
</tr>
</tr>
4 changes: 2 additions & 2 deletions app/views/insured/families/_shop_for_plans_widget.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@
<% new_options = @employee_role&.has_multiple_shop_oe_periods? ? options.merge(shop_under_future: true) : options %>
<%= l10n('plans.if_you') %>
<%= h(link_to "#{l10n('insured.enroll_today')}", new_insured_group_selection_path(new_options)) %>
<%= l10n('insured.coverage_will_begin', date: format_date(@employee_role.benefit_begin_date)) %>
<%= ", #{l10n('insured.coverage_will_begin', date: format_date(@employee_role.benefit_begin_date))}." %>
<%elsif (@person.consumer_role.present? || @person.resident_role.present?) && is_under_open_enrollment? %>
<%= l10n('plans.if_you') %>
<%= h(link_to "#{l10n('insured.enroll_today')}", new_insured_group_selection_path(options)) %>
<%= l10n('insured.coverage_will_begin', date: format_date(ivl_enrollment_effective_date)) %>
<%= ", #{l10n('insured.coverage_will_begin', date: format_date(ivl_enrollment_effective_date))}." %>
<% end %>
<% end %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/ui-components/v1/modals/_help_with_plan.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
<li><%= h(link_to l10n("insured.plan_shoppings.help_from_an_inperson_assister"), main_app.assister_index_exchanges_hbx_profiles_path, remote: true) %></li>
<% end %>
<% if EnrollRegistry.feature_enabled?(:contact_customer_service_representative) %>
<li class="name_search_only" id="CSR"><%= h(link_to l10n("insured.plan_shoppings.help_from_a_customer_service_representative")) %></li>
<li class="name_search_only" id="CAC"><%= h(link_to l10n("insured.plan_shoppings.help_from_a_certified_applicant_counselor")) %></li>
<li class="name_search_only" id="CSR"><%= h(link_to l10n("insured.plan_shoppings.help_from_a_customer_service_representative"), "#") %></li>
<li class="name_search_only" id="CAC"><%= h(link_to l10n("insured.plan_shoppings.help_from_a_certified_applicant_counselor"), "#") %></li>
<% end %>
</ul>
</div>
Expand Down
2 changes: 2 additions & 0 deletions db/seedfiles/translations/en/cca/insured.rb
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,6 @@
:'en.insured.contact_option.text' => "Text",
:'en.insured.contact_option.email' => "Email",
:'en.insured.contact_option.mail' => "Mail",
:'en.insured.terminated_by_employer' => "You have been terminated by your employer %{employer_name} with an effective date of %{date}",
:'en.insured.coverage_will_begin' => "coverage will begin %{date}"
}.freeze
4 changes: 3 additions & 1 deletion db/seedfiles/translations/en/dc/insured.rb
Original file line number Diff line number Diff line change
Expand Up @@ -774,5 +774,7 @@
:'en.insured.existing_person_record_warning_message' => 'Person is already affiliated with another account.',
:'en.insured.general_agency_index_disabled_warning' => 'The General Agency Index is Disabled',
:'en.insured.employer_datatable_disabled_warning' => 'The Employer Data Table is Disabled',
:'en.insured.plan_shopping.thankyou.agreement_terms_conditions' => 'You must complete Agreement and Terms and Conditions sections to continue.'
:'en.insured.plan_shopping.thankyou.agreement_terms_conditions' => 'You must complete Agreement and Terms and Conditions sections to continue.',
:'en.insured.terminated_by_employer' => "You have been terminated by your employer %{employer_name} with an effective date of %{date}",
:'en.insured.coverage_will_begin' => "coverage will begin %{date}"
}.freeze
5 changes: 4 additions & 1 deletion db/seedfiles/translations/en/me/insured.rb
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,8 @@
:'en.insured.general_agency_index_disabled_warning' => 'The General Agency Index is Disabled',
:'en.insured.employer_datatable_disabled_warning' => 'The Employer Data Table is Disabled',
:'en.insured.plan_shopping.thankyou.agreement_terms_conditions' => 'You must complete Agreement and Terms and Conditions sections to continue.',
:'en.eligibility.created' => 'THH & Eligibility created successfully.'
:'en.eligibility.created' => 'THH & Eligibility created successfully.',
:'en.insured.terminated_by_employer' => "You have been terminated by your employer %{employer_name} with an effective date of %{date}",
:'en.insured.enroll_today' => "enroll today",
:'en.insured.coverage_will_begin' => "coverage will begin %{date}"
}.freeze
2 changes: 1 addition & 1 deletion spec/controllers/concerns/vlp_doc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FakesController < ApplicationController
it "should convert the date string to dateTime instance" do
expect(subject.params[person_kind][:consumer_role][:vlp_documents_attributes]["0"][:expiration_date]).to be_a(String)
expect(subject.update_vlp_documents(consumer_role, person_kind))
expect(subject.params[person_kind][:consumer_role][:vlp_documents_attributes]["0"][:expiration_date]).to be_a(DateTime)
expect(subject.params[person_kind][:consumer_role][:vlp_documents_attributes]["0"][:expiration_date]).to be_a(Date)
end

context 'active_vlp_document_id' do
Expand Down
26 changes: 13 additions & 13 deletions spec/controllers/insured/family_members_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@

it "should render the edit template" do
expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end
end

Expand Down Expand Up @@ -519,7 +519,7 @@
it "should render the edit template" do
put :update, params: {id: test_family.family_members.last.id.to_s, dependent: invalid_dependent_properties}
expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end

it "addresses should be an array" do
Expand Down Expand Up @@ -557,7 +557,7 @@
allow(controller).to receive(:update_vlp_documents).and_return(false)
put :update, params: {id: test_family.family_members.last.id.to_s, dependent: dependent_properties}
expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end
end

Expand All @@ -575,7 +575,7 @@
it "should render the edit template" do
put :update, params: {id: test_family.family_members.last.id.to_s, dependent: dependent_properties}
expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end

it "should assign the address_errors" do
Expand Down Expand Up @@ -648,7 +648,7 @@

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("show")
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end

it "can't delete family members on behalf of another user" do
Expand Down Expand Up @@ -676,7 +676,7 @@
get :edit, params: { id: dependent_id }

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end
end
end
Expand Down Expand Up @@ -809,7 +809,7 @@
get :edit, params: { id: dependent_id }

expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end
end

Expand All @@ -822,7 +822,7 @@

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("show")
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end

it "can't delete family members for a user" do
Expand Down Expand Up @@ -850,7 +850,7 @@
get :edit, params: { id: dependent_id }

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end
end
end
Expand Down Expand Up @@ -996,7 +996,7 @@
get :edit, params: { id: dependent_id }

expect(response).to have_http_status(:success)
expect(response).to render_template("edit")
expect(response).to render_template("edit.js.erb")
end
end

Expand All @@ -1007,7 +1007,7 @@

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("show")
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end

it "can't delete family members for a user" do
Expand Down Expand Up @@ -1035,7 +1035,7 @@
get :edit, params: { id: dependent_id }

expect(response).to have_http_status(:redirect)
expect(response).to_not render_template("edit")
expect(response).to_not render_template("edit.js.erb")
end
end
end
Expand All @@ -1058,4 +1058,4 @@
it_behaves_like 'logged in user has no authorization roles for family_members controller', :index
it_behaves_like 'logged in user has no authorization roles for family_members controller', :new
end
end
end
4 changes: 2 additions & 2 deletions spec/helpers/insured/families_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@
end

it "returns the #{expected_label} label" do
expect(enrollment_state_label(enrollment)).to include(*expected_label)
expect(enrollment_state_label(enrollment, false)).to include(*expected_label)
end
end

Expand All @@ -766,7 +766,7 @@
end

it 'returns nil' do
expect(enrollment_state_label(enrollment)).to be_nil
expect(enrollment_state_label(enrollment, false)).to be_nil
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@
census_employee.update_attributes(employment_terminated_on: TimeKeeper.date_of_record)
allow(census_employee).to receive(:is_employee_in_term_pending?).and_return(true)
render "insured/families/shop_for_plans_widget"
expect(rendered).to have_text "You have been terminated by your employer"
expect(rendered).to have_text l10n('insured.terminated_by_employer', employer_name: employee_role.employer_profile.legal_name, date: format_date(employee_role.census_employee.employment_terminated_on.end_of_month))
end

it 'should show link enroll today text if census employee is terminated with future sep which falls in renewal PY' do
allow(census_employee).to receive(:is_employee_in_term_pending?).and_return(false)
allow(employee_role).to receive(:benefit_begin_date).and_return(TimeKeeper.date_of_record)
render "insured/families/shop_for_plans_widget"
expect(rendered).to have_content 'coverage will begin'
expect(rendered).to have_content l10n('insured.coverage_will_begin', date: format_date(employee_role.benefit_begin_date))
expect(rendered).to have_link('enroll today')
expect(rendered).not_to have_content 'for Open Enrollment Period.'
end
Expand Down
4 changes: 2 additions & 2 deletions spec/views/shared/_comparison.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
let(:plan) { FactoryBot.create(:plan,
provider_directory_url: "http://www.example1.com",
rx_formulary_url: "http://www.example.com") } # QHP still checking for old plan instance for rx_formulary_url & provider_directory_url in view file.

let(:mock_qhp){instance_double("Products::QhpCostShareVariance", :product => product, :plan => plan, :plan_marketing_name=> product.title)}
let(:mock_qhps) {[mock_qhp]}
let(:sbc_document) { double("SbcDocument", id: BSON::ObjectId.new, identifier: "download#abc") }
Expand Down Expand Up @@ -147,7 +147,7 @@
plan.update_attributes!(nationwide: true)
render "shared/comparison", :qhps => mock_qhps
expect(rendered).to match(/#{plan.rx_formulary_url}/)
expect(rendered).to match("DOCTOR DIRECTORY")
expect(rendered).to match(/DOCTOR DIRECTORY/i)
end

if aca_state_abbreviation == "DC" # There is no plan comparision for MA dental
Expand Down
9 changes: 5 additions & 4 deletions spec/views/shared/_individual_progress.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
before do
sign_in current_user
allow(view).to receive(:policy_helper).and_return(double("FamilyPolicy", updateable?: true))
allow(EnrollRegistry).to receive(:feature_enabled?).with(:bs4_consumer_flow).and_return false
end
# Helper to assert the presence of the continue button.
def assert_continue_button_present
expect(rendered).to have_selector('#btn-continue', count: 1)
def assert_continue_button_present(step)
expect(rendered).to have_selector('#btn-continue', count: 1) if step != "6"
end

# Helper to assert the visibility of specific links.
Expand Down Expand Up @@ -50,7 +51,7 @@ def mock_feature_state(feature, state)
end

it "validates button and link visibility" do
assert_continue_button_present
assert_continue_button_present(step)
# # Help sign up is inconsistent when back_to_account_all_shop is disabled.
skip_links = feature_state ? [] : ['help_sign_up']
# Validate links based on the current step and feature state.
Expand All @@ -60,4 +61,4 @@ def mock_feature_state(feature, state)
end
end
end
end
end
8 changes: 4 additions & 4 deletions spec/views/shared/_sep_progress.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
before { sign_in current_user }

# Helper to assert the presence of the continue button.
def assert_continue_button_present
expect(rendered).to have_selector('#btn-continue', count: 1)
def assert_continue_button_present(step)
expect(rendered).to have_selector('#btn-continue', count: 1) if step != "7"
end

# Helper to assert the visibility of specific links.
Expand Down Expand Up @@ -48,7 +48,7 @@ def mock_feature_state(feature, state)
end

it "validates button and link visibility" do
assert_continue_button_present
assert_continue_button_present(step)
# # Help sign up is inconsistent when back_to_account_all_shop is disabled.
skip_links = feature_state ? [] : ['help_sign_up']
# Validate links based on the current step and feature state.
Expand All @@ -58,4 +58,4 @@ def mock_feature_state(feature, state)
end
end
end
end
end
6 changes: 3 additions & 3 deletions spec/views/ui-components/v1/cards/_summary.html.slim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

it "should display standard plan indicator" do
render "ui-components/v1/cards/summary", :qhp => mock_qhp_cost_share_variance
expect(rendered).to have_selector('i', text: 'STANDARD PLAN')
expect(rendered).to have_content(/STANDARD PLAN/i)
end

it 'should display premium amount' do
Expand All @@ -106,11 +106,11 @@
end

it "should not have coinsurance text" do
expect(rendered).to have_selector('th', text: 'COINSURANCE')
expect(rendered).not_to have_selector('th', text: 'COINSURANCE')
end

it "should not have copay text" do
expect(rendered).to have_selector('th', text: 'CO-PAY')
expect(rendered).not_to have_selector('th', text: 'CO-PAY')
end
end

Expand Down

0 comments on commit 7931260

Please sign in to comment.