diff --git a/app/controllers/start_controller.rb b/app/controllers/start_controller.rb index 259b9039d..8f380805b 100644 --- a/app/controllers/start_controller.rb +++ b/app/controllers/start_controller.rb @@ -1,3 +1,7 @@ class StartController < ApplicationController - def index; end + def index + if current_user + redirect_to(case_logs_path) + end + end end diff --git a/spec/features/start_page_spec.rb b/spec/features/start_page_spec.rb index 27107bcb6..474a29de0 100644 --- a/spec/features/start_page_spec.rb +++ b/spec/features/start_page_spec.rb @@ -12,7 +12,6 @@ RSpec.describe "Start Page Features" do it "takes you to your logs" do visit("/") - click_link("Start now") expect(page).to have_current_path("/logs") end end diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 835321c6a..5715e3031 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -129,7 +129,7 @@ RSpec.describe "User Features" do fill_in("user[email]", with: user.email) fill_in("user[password]", with: "pAssword1") click_button("Sign in") - expect(page).to have_current_path("/") + expect(page).to have_current_path("/logs") end it "tries to access account page, redirects to log in page" do diff --git a/spec/requests/auth/passwords_controller_spec.rb b/spec/requests/auth/passwords_controller_spec.rb index 61f5cc50a..615455d83 100644 --- a/spec/requests/auth/passwords_controller_spec.rb +++ b/spec/requests/auth/passwords_controller_spec.rb @@ -59,8 +59,10 @@ RSpec.describe Auth::PasswordsController, type: :request do .to(change { user.reload.encrypted_password }) end - it "signs in" do + it "after password change, the user is signed in" do put "/users/password", params: update_password_params + # Devise redirects once after re-sign in with new password and then root redirects as well. + follow_redirect! follow_redirect! expect(page).to have_css("div", class: "govuk-notification-banner__heading", text: message) end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 9d93cb92b..9c537b885 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -247,6 +247,7 @@ RSpec.describe UsersController, type: :request do it "routes user to the /logs page" do get "/", headers: headers, params: {} expected_link = "href=\"/logs\">#{I18n.t('service_name')}" + follow_redirect! expect(CGI.unescape_html(response.body)).to include(expected_link) end end