From 646c4e2a67838bb14b5cf928b399b5eeaaa3ca95 Mon Sep 17 00:00:00 2001 From: Sea Date: Tue, 20 Feb 2018 17:51:45 +0400 Subject: [PATCH 1/2] Test homepage redirects to dashboard if user is logged in --- test/functional/home_controller_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 23f6be891b..13fd5d6b77 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -16,6 +16,13 @@ def setup assert_response :success 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 dashboard if not logged in' do get :dashboard From 1a7289b23a271144e94c9130a2c3331b51d2f606 Mon Sep 17 00:00:00 2001 From: Sea Date: Tue, 20 Feb 2018 18:02:09 +0400 Subject: [PATCH 2/2] Add title check to homepage test --- test/functional/home_controller_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 13fd5d6b77..27b4852aed 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -11,9 +11,11 @@ def setup end test 'should get home' do - get :home + 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