Class: ActionController::TestSession

Inherits:
Object
  • 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.



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

def initialize(attributes = nil)
  @session_id = ''
  @attributes = attributes.nil? ? nil : attributes.stringify_keys
  @saved_attributes = nil
end

Instance Attribute Details

#session_idObject

Returns the value of attribute session_id.



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

def session_id
  @session_id
end

Instance Method Details

#[](key) ⇒ Object



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

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

#[]=(key, value) ⇒ Object



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

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

#closeObject



323
324
325
326
# File 'lib/action_controller/test_process.rb', line 323

def close
  update
  delete
end

#dataObject



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

def data
  @attributes ||= @saved_attributes || {}
end

#deleteObject



319
320
321
# File 'lib/action_controller/test_process.rb', line 319

def delete
  @attributes = nil
end

#updateObject



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

def update
  @saved_attributes = @attributes
end