require 'test_helper' class HomeControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers setup do @user = User.create(email: 'testing.another@user.account.org', password: 'password123', password_confirmation: 'password123', accept_terms: true, confirmed_at: Time.zone.now) end # ---------------------------------------------------------- test 'redirects logged in user to plans page' do @user.firstname = 'Testing' @user.surname = 'Another' @user.save! sign_in @user get root_path assert_response :redirect assert_redirected_to plans_url end # ---------------------------------------------------------- test 'redirects logged in user to profile page if they have not added their name' do sign_in @user get root_path assert_response :redirect # TODO: This should be redirecting to the profile page so that the user can provide their name but the logic # in the User model will always return the email address as the name so the check in the controller # is always true and sends the user through to the plans page #assert_redirected_to edit_user_registration_path assert_redirected_to plans_url end end