Adding i18n flash message when session is expired.

This commit is contained in:
Carlos Antonio da Silva
2009-11-23 22:56:04 -02:00
parent 4ba34290c7
commit a88731bb93
4 changed files with 28 additions and 17 deletions

View File

@@ -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