Skip to content

Commit

Permalink
Add test for Issue heartcombo#2190
Browse files Browse the repository at this point in the history
Seems to be passing for me.
  • Loading branch information
latortuga committed Jan 31, 2013
1 parent 25296d8 commit c9c1e13
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/integration/authenticatable_test.rb
Expand Up @@ -662,3 +662,26 @@ def sign_in!(scope)
assert warden.authenticated?(:sign_out_via_delete_or_post)
end
end

class DoubleAuthenticationRedirectTest < ActionDispatch::IntegrationTest
test 'signed in as user redirects when visiting user sign in page' do
sign_in_as_user
get new_user_session_path(:format => :html)
assert_redirected_to '/'
end

test 'signed in as admin redirects when visiting admin sign in page' do
sign_in_as_admin
get new_admin_session_path(:format => :html)
assert_redirected_to '/admin_area/home'
end

test 'signed in as both user and admin redirects when visiting admin sign in page' do
sign_in_as_user
sign_in_as_admin
get new_user_session_path(:format => :html)
assert_redirected_to '/'
get new_admin_session_path(:format => :html)
assert_redirected_to '/admin_area/home'
end
end

0 comments on commit c9c1e13

Please sign in to comment.