mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Adding i18n flash message when session is expired.
This commit is contained in:
@@ -15,6 +15,18 @@ class SessionTimeoutTest < ActionController::IntegrationTest
|
||||
assert_not_equal old_last_request, last_request_at
|
||||
end
|
||||
|
||||
test 'not time out user session before default limit time' do
|
||||
user = sign_in_as_user
|
||||
|
||||
# Setup last_request_at to timeout
|
||||
get edit_user_path(user)
|
||||
assert_not_nil last_request_at
|
||||
|
||||
get users_path
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'time out user session after default limit time' do
|
||||
sign_in_as_user
|
||||
assert_response :success
|
||||
@@ -29,18 +41,6 @@ class SessionTimeoutTest < ActionController::IntegrationTest
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'not time out user session before default limit time' do
|
||||
user = sign_in_as_user
|
||||
|
||||
# Setup last_request_at to timeout
|
||||
get edit_user_path(user)
|
||||
assert_not_nil last_request_at
|
||||
|
||||
get users_path
|
||||
assert_response :success
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test 'user configured timeout limit' do
|
||||
swap Devise, :timeout => 8.minutes do
|
||||
user = sign_in_as_user
|
||||
@@ -57,4 +57,17 @@ class SessionTimeoutTest < ActionController::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test 'error message with i18n' do
|
||||
store_translations :en, :devise => {
|
||||
:sessions => { :user => { :timeout => 'Session expired!' } }
|
||||
} do
|
||||
sign_in_as_user
|
||||
# Setup last_request_at to timeout
|
||||
get new_user_path
|
||||
get users_path
|
||||
follow_redirect!
|
||||
assert_contain 'Session expired!'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user