From e91c58b12f870c1c1e6fa9ff048d1bef45d4cf43 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Wed, 25 Sep 2024 11:31:14 +0100 Subject: [PATCH] Hard redirect offsite (#441) * redirect traffic to guidance pages * redirect closed service offsite --- app/controllers/application_controller.rb | 5 ++++- spec/features/admin_console/settings_spec.rb | 6 +++--- spec/features/open_close_spec.rb | 9 +-------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ec58aac3..5ae53312 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,7 +9,10 @@ def check_service_open! return if request.path == destroy_user_session_path # skip this for log out page return if Gatekeeper.application_open? - redirect_to(closed_path) + redirect_to( + "https://getintoteaching.education.gov.uk/non-uk-teachers/get-an-international-relocation-payment", + allow_other_host: true, + ) end def current_form diff --git a/spec/features/admin_console/settings_spec.rb b/spec/features/admin_console/settings_spec.rb index 6c48621c..3bbb5726 100644 --- a/spec/features/admin_console/settings_spec.rb +++ b/spec/features/admin_console/settings_spec.rb @@ -22,7 +22,7 @@ it "does allow access to non-admin if Service is closed" do given_the_service_is_closed visit root_path - then_i_should_see_the_service_closed_page + then_i_should_see_offsite_guidance_page end private @@ -31,8 +31,8 @@ def given_the_service_is_closed AppSettings.current.update!(service_start_date: 2.days.from_now) end - def then_i_should_see_the_service_closed_page - expect(page).to have_current_path("/closed") + def then_i_should_see_offsite_guidance_page + expect(page.current_url).to eql("https://getintoteaching.education.gov.uk/non-uk-teachers/get-an-international-relocation-payment") end def when_i_visit_the_settings_page diff --git a/spec/features/open_close_spec.rb b/spec/features/open_close_spec.rb index 20b3a480..5abc4356 100644 --- a/spec/features/open_close_spec.rb +++ b/spec/features/open_close_spec.rb @@ -34,14 +34,7 @@ it "does not allow the user access to the landing page" do visit root_path - expect(page).to have_current_path("/closed") - end - - it "allows the user access to the admin tool" do - given_i_am_signed_with_role(:admin) - visit applicants_path - - expect(page).to have_text("Applications") + expect(page.current_url).to eql("https://getintoteaching.education.gov.uk/non-uk-teachers/get-an-international-relocation-payment") end end end