diff options
author | Scott Taylor <scott@railsnewbie.com> | 2009-01-29 19:39:48 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-29 19:39:48 -0600 |
commit | 2dedb5b03ab88a1c31068f71c8d4cad7c5a5d9ae (patch) | |
tree | 7429cf580c86e7c306216cf5f5f2287daab8564d /actionpack/lib | |
parent | 1b79683171eeb0f5eb07928aeace890dafe773fc (diff) | |
download | rails-2dedb5b03ab88a1c31068f71c8d4cad7c5a5d9ae.tar.gz rails-2dedb5b03ab88a1c31068f71c8d4cad7c5a5d9ae.tar.bz2 rails-2dedb5b03ab88a1c31068f71c8d4cad7c5a5d9ae.zip |
Controller, response, and request should all refer to same session, even after a call to session_reset [#1823 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index ea17363c47..4b5fc3a3c1 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -15,7 +15,7 @@ module ActionController #:nodoc: end def reset_session - @session = TestSession.new + @session.reset end # Wraps raw_post in a StringIO. @@ -284,9 +284,13 @@ module ActionController #:nodoc: attr_accessor :session_id def initialize(attributes = nil) - @session_id = '' - attributes ||= {} - replace(attributes.stringify_keys) + reset_session_id + replace_attributes(attributes) + end + + def reset + reset_session_id + replace_attributes({ }) end def data @@ -322,6 +326,17 @@ module ActionController #:nodoc: def close ActiveSupport::Deprecation.warn('sessions should no longer be closed', caller) end + + private + + def reset_session_id + @session_id = '' + end + + def replace_attributes(attributes = nil) + attributes ||= {} + replace(attributes.stringify_keys) + end end # Essentially generates a modified Tempfile object similar to the object |