From 10accffce6d33fec676144c52097252f68b12b96 Mon Sep 17 00:00:00 2001 From: Raul Riera Date: Wed, 22 Apr 2026 10:39:54 -0400 Subject: [PATCH] fix(subscriptions): add expiring banner coverage --- .../functional/application_controller_test.rb | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/functional/application_controller_test.rb diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb new file mode 100644 index 00000000..7c7450f1 --- /dev/null +++ b/test/functional/application_controller_test.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'test_helper' + +class ApplicationControllerTest < ActionController::TestCase + tests PatientsController + + setup do + @controller.session['user'] = users(:founder) + end + + test 'shows expiring subscription warning banner on authenticated pages' do + users(:founder).practice.subscription.update_columns(current_period_end: 6.days.from_now) + expected_warning = I18n.t('subscriptions.errors.expiring', practice_settings_url: practice_settings_url) + + get :index + + assert_response :success + assert_equal expected_warning, flash[:warning].to_s + assert_select '.alert.alert-warning .text-muted', text: /Your subscription will expire soon/ + assert_includes response.body, expected_warning + end +end