From 2f0c204d34e3d7c77d420e1209e40c3ee4e5cefb Mon Sep 17 00:00:00 2001 From: Sea <30443703+seafr@users.noreply.github.com> Date: Wed, 7 Mar 2018 19:45:43 +0400 Subject: [PATCH] Home controller tests - test redirect and title (#2371) * Test homepage redirects to dashboard if user is logged in * Add title check to homepage test --- test/functional/home_controller_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 26bc0e0c192..5cd5850890a 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -11,8 +11,18 @@ def setup end test 'should get home' do + title = I18n.t('home_controller.science_community') + get :home assert_response :success + assert_select "title", "🎈 Public Lab: #{title}" + end + + test 'home should redirect to dashboard if logged in' do + UserSession.create(users(:bob)) + + get :home + assert_redirected_to dashboard_url end test 'should get research if not logged by /dashboard' do