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.



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

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

Instance Attribute Details

#session_idObject

Returns the value of attribute session_id.



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

def session_id
  @session_id
end

Instance Method Details

#[](key) ⇒ Object



312
313
314
# File 'lib/action_controller/test_process.rb', line 312

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

#[]=(key, value) ⇒ Object



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

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

#closeObject



338
339
340
# File 'lib/action_controller/test_process.rb', line 338

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

#dataObject



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

def data
  to_hash
end

#delete(key = nil) ⇒ Object



329
330
331
332
333
334
335
336
# File 'lib/action_controller/test_process.rb', line 329

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

#resetObject



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

def reset
  reset_session_id
  replace_attributes({ })
end

#update(hash = nil) ⇒ Object



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

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