Skip to content

Commit

Permalink
CAPT-2104 Redirect to start page if no reminder in session
Browse files Browse the repository at this point in the history
  • Loading branch information
kenfodder committed Jan 8, 2025
1 parent ec80244 commit 5fb221a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/controllers/reminders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def show

if @form.set_reminder_from_claim
redirect_to reminder_path(journey: journey::ROUTING_NAME, slug: "confirmation")
elsif params[:slug] == "confirmation" && @form.reminder.nil?
redirect_to journey_session.journey_class.start_page_url
else
render view_file
end
Expand Down
2 changes: 1 addition & 1 deletion app/forms/reminders/confirmation_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def set_reminder_from_claim
private

def itt_subject
journey_session.answers.eligible_itt_subject
defined?(journey_session.answers.eligible_itt_subject) ? journey_session.answers.eligible_itt_subject : nil
end

def itt_subject_for_submitted_claim
Expand Down
31 changes: 26 additions & 5 deletions spec/requests/reminders_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require "rails_helper"

RSpec.describe "Claims" do
before do
create(:journey_configuration, :additional_payments)
start_claim("additional-payments")
end

describe "#create" do
before do
create(:journey_configuration, :additional_payments)
start_claim("additional-payments")
end

let(:submit_form) { put reminder_path(journey: "additional-payments", slug: "personal-details", params: form_params) }

context "with full name and valid email address" do
Expand Down Expand Up @@ -57,4 +57,25 @@
end
end
end

# Rollbar error - confirmation page loaded without reminder that can be loaded from the session information
describe "#show" do
shared_examples "confirmation_page_no_reminder" do |journey|
before do
create(:journey_configuration, journey::ROUTING_NAME.underscore.to_sym)
end

subject { get reminder_path(journey: journey::ROUTING_NAME.to_sym, slug: "confirmation") }

it { is_expected.to redirect_to(journey.start_page_url) }
end

describe "for FurtherEducationPayments journey" do
include_examples "confirmation_page_no_reminder", Journeys::FurtherEducationPayments
end

describe "for AdditionalPaymentsForTeaching journey" do
include_examples "confirmation_page_no_reminder", Journeys::AdditionalPaymentsForTeaching
end
end
end

0 comments on commit 5fb221a

Please sign in to comment.