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:
parent
2651a87a33
commit
9c9f416d39
2 changed files with 21 additions and 0 deletions
|
@ -27,6 +27,12 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def renew
|
||||||
|
env["rack.session.options"][:renew] = true
|
||||||
|
session[:foo] = "baz"
|
||||||
|
head :ok
|
||||||
|
end
|
||||||
|
|
||||||
def rescue_action(e) raise end
|
def rescue_action(e) raise end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,6 +70,20 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def test_getting_nil_session_value
|
def test_getting_nil_session_value
|
||||||
|
|
|
@ -321,6 +321,7 @@ module ActiveRecord
|
||||||
if sid = current_session_id(env)
|
if sid = current_session_id(env)
|
||||||
Base.silence do
|
Base.silence do
|
||||||
get_session_model(env, sid).destroy
|
get_session_model(env, sid).destroy
|
||||||
|
env[SESSION_RECORD_KEY] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue