diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-27 12:26:50 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-27 12:28:05 -0600 |
commit | f17c87665e36206bcae9c260cb25cd67bf9695e6 (patch) | |
tree | e6bcdb08192b10ce6da07663791ab4b69dcec6f6 /actionpack/lib/action_controller/test_process.rb | |
parent | 57b156b33874431fedd1dacc952a4bc781628a07 (diff) | |
download | rails-f17c87665e36206bcae9c260cb25cd67bf9695e6.tar.gz rails-f17c87665e36206bcae9c260cb25cd67bf9695e6.tar.bz2 rails-f17c87665e36206bcae9c260cb25cd67bf9695e6.zip |
Fixed deprecated methods on TestSession [#1801 state:resolved]
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index d2c4ebf98c..ea17363c47 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -280,38 +280,47 @@ module ActionController #:nodoc: end end - class TestSession #:nodoc: + class TestSession < Hash #:nodoc: attr_accessor :session_id def initialize(attributes = nil) @session_id = '' - @attributes = attributes.nil? ? nil : attributes.stringify_keys - @saved_attributes = nil + attributes ||= {} + replace(attributes.stringify_keys) end def data - @attributes ||= @saved_attributes || {} + to_hash end def [](key) - data[key.to_s] + super(key.to_s) end def []=(key, value) - data[key.to_s] = value + super(key.to_s, value) end - def update - @saved_attributes = @attributes + def update(hash = nil) + if hash.nil? + ActiveSupport::Deprecation.warn('use replace instead', caller) + replace({}) + else + super(hash) + end end - def delete - @attributes = nil + def delete(key = nil) + if key.nil? + ActiveSupport::Deprecation.warn('use clear instead', caller) + clear + else + super(key.to_s) + end end def close - update - delete + ActiveSupport::Deprecation.warn('sessions should no longer be closed', caller) end end |