diff options
author | Kenny Ortmann <kenny.ortmann@gmail.com> | 2009-04-07 09:18:42 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-04-07 09:18:42 -0500 |
commit | f448c70b3f6c6698bce9c95fa4328c251fe085ee (patch) | |
tree | 322e3632d4a0604f571e3fff35a878f8371dd573 /actionpack/lib/action_controller/test_process.rb | |
parent | f209d3898fbd866e1405861319b85c97674a0508 (diff) | |
download | rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.tar.gz rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.tar.bz2 rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.zip |
added tests for session options being defaulted correctly to rack defaults [#2403 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index b2d1341573..93a3f9d874 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -1,3 +1,4 @@ +require 'rack/session/abstract/id' module ActionController #:nodoc: class TestRequest < Request #:nodoc: attr_accessor :cookies, :session_options @@ -13,7 +14,8 @@ module ActionController #:nodoc: @query_parameters = {} @session = TestSession.new - @session_options ||= {} + default_rack_options = Rack::Session::Abstract::ID::DEFAULT_OPTIONS + @session_options ||= {:id => generate_sid(default_rack_options[:sidbits])}.merge(default_rack_options) initialize_default_values initialize_containers @@ -122,6 +124,10 @@ module ActionController #:nodoc: end private + def generate_sid(sidbits) + "%0#{sidbits / 4}x" % rand(2**sidbits - 1) + end + def initialize_containers @cookies = {} end |