123456789_123456789_123456789_123456789_123456789_

Class: ActionController::TestSession

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Rack::Session::Abstract::PersistedSecure::SecureSessionHash
Instance Chain:
self, Rack::Session::Abstract::PersistedSecure::SecureSessionHash
Inherits: Rack::Session::Abstract::PersistedSecure::SecureSessionHash
  • ::Object
Defined in: actionpack/lib/action_controller/test_case.rb

Overview

Methods #destroy and #load! are overridden to avoid calling methods on the

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(session = {}, id = Rack::Session::SessionId.new(SecureRandom.hex(16))) ⇒ TestSession

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 190

def initialize(session = {}, id = Rack::Session::SessionId.new(SecureRandom.hex(16)))
  super(nil, nil)
  @id = id
  @data = stringify_keys(session)
  @loaded = true
  @initially_empty = @data.empty?
end

Instance Attribute Details

#enabled?Boolean (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 223

def enabled?
  true
end

#exists?Boolean (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 198

def exists?
  true
end

Instance Method Details

#destroy

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 210

def destroy
  clear
end

#dig(*keys)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 214

def dig(*keys)
  keys = keys.map.with_index { |key, i| i.zero? ? key.to_s : key }
  @data.dig(*keys)
end

#fetch(key, *args, &block)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 219

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

#id_was

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 227

def id_was
  @id
end

#keys

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 202

def keys
  @data.keys
end

#load! (private)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 232

def load!
  @id
end

#values

[ GitHub ]

  
# File 'actionpack/lib/action_controller/test_case.rb', line 206

def values
  @data.values
end