Class: ActionController::TestSession

Inherits:
Rack::Session::Abstract::SessionHash
  • Object
show all
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::ID::DEFAULT_OPTIONS

Instance Method Summary collapse

Constructor Details

#initialize(session = {}) ⇒ TestSession

Returns a new instance of TestSession.



289
290
291
292
293
294
# File 'lib/action_controller/test_case.rb', line 289

def initialize(session = {})
  super(nil, nil)
  @id = SecureRandom.hex(16)
  @data = stringify_keys(session)
  @loaded = true
end

Instance Method Details

#destroyObject



308
309
310
# File 'lib/action_controller/test_case.rb', line 308

def destroy
  clear
end

#exists?Boolean

Returns:

  • (Boolean)


296
297
298
# File 'lib/action_controller/test_case.rb', line 296

def exists?
  true
end

#keysObject



300
301
302
# File 'lib/action_controller/test_case.rb', line 300

def keys
  @data.keys
end

#valuesObject



304
305
306
# File 'lib/action_controller/test_case.rb', line 304

def values
  @data.values
end