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 192

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 225

def enabled?
  true
end

#exists?Boolean (readonly)

[ GitHub ]

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

def exists?
  true
end

Instance Method Details

#destroy

[ GitHub ]

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

def destroy
  clear
end

#dig(*keys)

[ GitHub ]

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

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 221

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 229

def id_was
  @id
end

#keys

[ GitHub ]

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

def keys
  @data.keys
end

#load! (private)

[ GitHub ]

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

def load!
  @id
end

#values

[ GitHub ]

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

def values
  @data.values
end