Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard redirect offsite #441

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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