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


309
310
311
312
313
314
# File 'actionpack/lib/action_controller/test_case.rb', line 309

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

Instance Method Details

#destroyObject


328
329
330
# File 'actionpack/lib/action_controller/test_case.rb', line 328

def destroy
  clear
end

#exists?Boolean


316
317
318
# File 'actionpack/lib/action_controller/test_case.rb', line 316

def exists?
  true
end

#fetch(key, *args, &block) ⇒ Object


332
333
334
# File 'actionpack/lib/action_controller/test_case.rb', line 332

def fetch(key, *args, &block)
  @data.fetch(key.to_s, *args, &block)
end

#keysObject


320
321
322
# File 'actionpack/lib/action_controller/test_case.rb', line 320

def keys
  @data.keys
end

#valuesObject


324
325
326
# File 'actionpack/lib/action_controller/test_case.rb', line 324

def values
  @data.values
end