Class ActionDispatch::Integration::Session
In: lib/action_dispatch/testing/integration.rb
Parent: Object

An instance of this class represents a set of requests and responses performed sequentially by a test process. Because you can instantiate multiple sessions and run them side-by-side, you can also mimic (to some limited extent) multiple simultaneous users interacting with your system.

Typically, you will instantiate a new session using IntegrationTest#open_session, rather than instantiating Integration::Session directly.

Methods

cookies   default_url_options   host   host!   https!   https?   new   reset!  

Included Modules

Test::Unit::Assertions TestProcess RequestHelpers Assertions ActionDispatch::Routing::UrlFor ActionController::Testing

Constants

DEFAULT_HOST = "www.example.com"

Attributes

accept  [RW]  The Accept header to send.
controller  [R]  A reference to the controller instance used by the last request.
host  [W] 
remote_addr  [RW]  The remote_addr used in the last request.
request  [R]  A reference to the request instance used by the last request.
request_count  [RW]  A running counter of the number of requests processed.
response  [R]  A reference to the response instance used by the last request.

Public Class methods

Create and initialize a new Session instance.

Public Instance methods

A map of the cookies returned by the last response, and which will be sent with the next request.

The hostname used in the last request.

Set the host name to use in the next request.

  session.host! "www.example.com"

Specify whether or not the session should mimic a secure HTTPS request.

  session.https!
  session.https!(false)

Return true if the session is mimicking a secure HTTPS request.

  if session.https?
    ...
  end

Resets the instance. This can be used to reset the state information in an existing session instance, so it can be used from a clean-slate condition.

  session.reset!

[Validate]