Class: ActionController::TestSession
- Inherits:
-
Rack::Session::Abstract::SessionHash
- Object
- Rack::Session::Abstract::SessionHash
- ActionController::TestSession
- Defined in:
- lib/action_controller/test_case.rb
Overview
Methods #destroy and #load! are overridden to avoid calling methods on the
Constant Summary collapse
- DEFAULT_OPTIONS =
:nodoc:
Rack::Session::Abstract::Persisted::DEFAULT_OPTIONS
Instance Method Summary collapse
- #destroy ⇒ Object
- #exists? ⇒ Boolean
- #fetch(key, *args, &block) ⇒ Object
-
#initialize(session = {}) ⇒ TestSession
constructor
A new instance of TestSession.
- #keys ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(session = {}) ⇒ TestSession
Returns a new instance of TestSession.
183 184 185 186 187 188 |
# File 'lib/action_controller/test_case.rb', line 183 def initialize(session = {}) super(nil, nil) @id = SecureRandom.hex(16) @data = stringify_keys(session) @loaded = true end |
Instance Method Details
#destroy ⇒ Object
202 203 204 |
# File 'lib/action_controller/test_case.rb', line 202 def destroy clear end |
#exists? ⇒ Boolean
190 191 192 |
# File 'lib/action_controller/test_case.rb', line 190 def exists? true end |
#fetch(key, *args, &block) ⇒ Object
206 207 208 |
# File 'lib/action_controller/test_case.rb', line 206 def fetch(key, *args, &block) @data.fetch(key.to_s, *args, &block) end |
#keys ⇒ Object
194 195 196 |
# File 'lib/action_controller/test_case.rb', line 194 def keys @data.keys end |
#values ⇒ Object
198 199 200 |
# File 'lib/action_controller/test_case.rb', line 198 def values @data.values end |