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.



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

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.



285
286
287
# File 'lib/action_controller/test_process.rb', line 285

def session_id
  @session_id
end

Instance Method Details

#[](key) ⇒ Object



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

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

#[]=(key, value) ⇒ Object



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

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

#closeObject



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

def close
  update
  delete
end

#dataObject



293
294
295
# File 'lib/action_controller/test_process.rb', line 293

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

#deleteObject



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

def delete
  @attributes = nil
end

#updateObject



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

def update
  @saved_attributes = @attributes
end