Class: ActionController::TestSession

Inherits:
Hash
  • Object
show all
Defined in:
lib/action_controller/test_process.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ TestSession

Returns a new instance of TestSession.



290
291
292
293
# File 'lib/action_controller/test_process.rb', line 290

def initialize(attributes = nil)
  reset_session_id
  replace_attributes(attributes)
end

Instance Attribute Details

#session_idObject

Returns the value of attribute session_id.



288
289
290
# File 'lib/action_controller/test_process.rb', line 288

def session_id
  @session_id
end

Instance Method Details

#[](key) ⇒ Object



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

def [](key)
  super(key.to_s)
end

#[]=(key, value) ⇒ Object



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

def []=(key, value)
  super(key.to_s, value)
end

#closeObject



330
331
332
# File 'lib/action_controller/test_process.rb', line 330

def close
  ActiveSupport::Deprecation.warn('sessions should no longer be closed', caller)
end

#dataObject



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

def data
  to_hash
end

#delete(key = nil) ⇒ Object



321
322
323
324
325
326
327
328
# File 'lib/action_controller/test_process.rb', line 321

def delete(key = nil)
  if key.nil?
    ActiveSupport::Deprecation.warn('use clear instead', caller)
    clear
  else
    super(key.to_s)
  end
end

#resetObject



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

def reset
  reset_session_id
  replace_attributes({ })
end

#update(hash = nil) ⇒ Object



312
313
314
315
316
317
318
319
# File 'lib/action_controller/test_process.rb', line 312

def update(hash = nil)
  if hash.nil?
    ActiveSupport::Deprecation.warn('use replace instead', caller)
    replace({})
  else
    super(hash)
  end
end