Class: ActionController::TestSession

Inherits:
Rack::Session::Abstract::SessionHash
  • Object
show all
Defined in:
actionpack/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


263
264
265
266
267
268
# File 'actionpack/lib/action_controller/test_case.rb', line 263

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

Instance Method Details

#destroyObject


282
283
284
# File 'actionpack/lib/action_controller/test_case.rb', line 282

def destroy
  clear
end

#exists?Boolean

Returns:

  • (Boolean)

270
271
272
# File 'actionpack/lib/action_controller/test_case.rb', line 270

def exists?
  true
end

#keysObject


274
275
276
# File 'actionpack/lib/action_controller/test_case.rb', line 274

def keys
  @data.keys
end

#valuesObject


278
279
280
# File 'actionpack/lib/action_controller/test_case.rb', line 278

def values
  @data.values
end