mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Refactoring timeoutable module and confirmable tests.
This commit is contained in:
@@ -59,19 +59,21 @@ class ConfirmationTest < ActionController::IntegrationTest
|
||||
end
|
||||
|
||||
test 'not confirmed user with setup to block without confirmation should not be able to sign in' do
|
||||
Devise.confirm_within = 0
|
||||
sign_in_as_user(:confirm => false)
|
||||
swap Devise, :confirm_within => 0.days do
|
||||
sign_in_as_user(:confirm => false)
|
||||
|
||||
assert_contain 'You have to confirm your account before continuing'
|
||||
assert_not warden.authenticated?(:user)
|
||||
assert_contain 'You have to confirm your account before continuing'
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'not confirmed user but configured with some days to confirm should be able to sign in' do
|
||||
Devise.confirm_within = 1
|
||||
sign_in_as_user(:confirm => false)
|
||||
swap Devise, :confirm_within => 1.day do
|
||||
sign_in_as_user(:confirm => false)
|
||||
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'error message is configurable by resource name' do
|
||||
|
||||
@@ -41,4 +41,20 @@ class SessionTimeoutTest < ActionController::IntegrationTest
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'user configured timeout limit' do
|
||||
swap Devise, :timeout => 8.minutes do
|
||||
user = sign_in_as_user
|
||||
|
||||
# Setup last_request_at to timeout
|
||||
get edit_user_path(user)
|
||||
assert_not_nil last_request_at
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
get users_path
|
||||
assert_redirected_to new_user_session_path(:timeout => true)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user