1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow AR Session Store to be renewed

This commit is contained in:
José Valim 2010-11-11 14:17:14 +01:00
parent 2651a87a33
commit 9c9f416d39
2 changed files with 21 additions and 0 deletions

View file

@ -27,6 +27,12 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest
head :ok
end
def renew
env["rack.session.options"][:renew] = true
session[:foo] = "baz"
head :ok
end
def rescue_action(e) raise end
end
@ -64,6 +70,20 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest
end
end
end
define_method("test_renewing_with_#{class_name}_store") do
with_store class_name do
with_test_route_set do
get '/set_session_value'
assert_response :success
assert cookies['_session_id']
get '/renew'
assert_response :success
assert_not_equal [], headers['Set-Cookie']
end
end
end
end
def test_getting_nil_session_value

View file

@ -321,6 +321,7 @@ module ActiveRecord
if sid = current_session_id(env)
Base.silence do
get_session_model(env, sid).destroy
env[SESSION_RECORD_KEY] = nil
end
end