Skip to content

Commit

Permalink
Hard redirect offsite (#441)
Browse files Browse the repository at this point in the history
* redirect traffic to guidance pages

* redirect closed service offsite
  • Loading branch information
asmega authored Sep 25, 2024
1 parent 3d11fe1 commit e91c58b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 4 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/features/admin_console/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 1 addition & 8 deletions spec/features/open_close_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e91c58b

Please sign in to comment.