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

Use request.session.id instead of request.session_options[:id]

As of the upgrade to Rack 1.5, request.session_options[:id] is no
longer populated. Reflect this change in the tests by using
request.session.id instead.

Related change in Rack:
https://github.com/rack/rack/commit/83a270d6
This commit is contained in:
Brian John 2015-03-12 09:52:38 -05:00
parent 1b7ae86f26
commit 82402e6583
5 changed files with 5 additions and 13 deletions

View file

@ -201,7 +201,7 @@ module ActionController
super
self.session = TestSession.new
self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => SecureRandom.hex(16))
self.session_options = TestSession::DEFAULT_OPTIONS
end
def assign_parameters(routes, controller_path, action, parameters = {})

View file

@ -24,12 +24,4 @@ class ActionController::TestRequestTest < ActiveSupport::TestCase
end
end
def test_session_id_exists_by_default
assert_not_nil(@request.session_options[:id])
end
def test_session_id_different_on_each_call
assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id])
end
end

View file

@ -22,7 +22,7 @@ class CacheStoreTest < ActionDispatch::IntegrationTest
end
def get_session_id
render :text => "#{request.session_options[:id]}"
render :text => "#{request.session.id}"
end
def call_reset_session

View file

@ -29,7 +29,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
end
def get_session_id
render :text => "id: #{request.session_options[:id]}"
render :text => "id: #{request.session.id}"
end
def get_class_after_reset_session
@ -53,7 +53,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
end
def change_session_id
request.session_options[:id] = nil
request.session.options[:id] = nil
get_session_id
end

View file

@ -23,7 +23,7 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest
end
def get_session_id
render :text => "#{request.session_options[:id]}"
render :text => "#{request.session.id}"
end
def call_reset_session