Skip to content

Commit ff2ae2b

Browse files
committed
added my_activity redirection tests
1 parent 46e65d6 commit ff2ae2b

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

test/controllers/users_controller_test.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,22 @@ class UsersControllerTest < ActionController::TestCase
300300
assert_not_nil assigns(:user)
301301
end
302302

303-
test 'my_network should redirect to current user network profile or to sign in otherwise' do
303+
test 'my_activity should redirect to user activity or to sign in for anonymous access' do
304+
users.each do |user|
305+
sign_in user
306+
get :my_activity
307+
308+
if user.deleted? || user.community_user.deleted?
309+
assert_redirected_to_sign_in
310+
else
311+
assert_redirected_to user_activity_path(user), "user #{user.name} is incorrectly redirected"
312+
end
313+
314+
sign_out :user
315+
end
316+
end
317+
318+
test 'my_network should redirect to user network profile or to sign in for anonymous access' do
304319
users.each do |user|
305320
sign_in user
306321
get :my_network
@@ -315,7 +330,7 @@ class UsersControllerTest < ActionController::TestCase
315330
end
316331
end
317332

318-
test 'my_vote_summary should redirect to current user summary or to sign in otherwise' do
333+
test 'my_vote_summary should redirect to user summary or to sign in for anonymous access' do
319334
users.each do |user|
320335
sign_in user
321336
get :my_vote_summary

0 commit comments

Comments
 (0)