diff --git a/test/integration/authentication_test.rb b/test/integration/authentication_test.rb index 2a179bd..cdf5e98 100644 --- a/test/integration/authentication_test.rb +++ b/test/integration/authentication_test.rb @@ -9,14 +9,11 @@ # ---------------------------------------------------------- test 'can sign in with valid email and password' do - get root_path - assert_response :success - sign_in @user - # Make sure that the user is sent to the page that lists their plans - assert_response :success - assert_select '.main_page_content h1', I18n.t('helpers.project.projects_title') + get root_path + + assert_authorized_redirect_to_plans_page end # ---------------------------------------------------------- diff --git a/test/test_helper.rb b/test/test_helper.rb index 5b149f0..d090119 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -42,12 +42,11 @@ assert_response :redirect assert_match "#{root_url}", @response.redirect_url - # Devise intermediary step prior to sending the user to the final destination - follow_redirect! - assert_response :redirect - assert_redirected_to "#{projects_url}" + # Sometimes Devise has an intermediary step prior to sending the user to the final destination + while @response.status >= 300 && @response.status < 400 + follow_redirect! + end - follow_redirect! assert_response :success assert_select '.main_page_content h1', I18n.t('helpers.project.projects_title') end