edge badge
Methods
A
C
D
M
O
R
Included Modules
Constants
APP_SESSIONS = {}
 
Instance Public methods
app()
# File actionpack/lib/action_dispatch/testing/integration.rb, line 391
def app
  @app ||= nil
end
create_session(app)
# File actionpack/lib/action_dispatch/testing/integration.rb, line 401
def create_session(app)
  klass = APP_SESSIONS[app] ||= Class.new(Integration::Session) {
    # If the app is a Rails app, make url_helpers available on the session
    # This makes app.url_for and app.foo_path available in the console
    if app.respond_to?(:routes)
      include app.routes.url_helpers
      include app.routes.mounted_helpers
    end
  }
  klass.new(app)
end
default_url_options()
# File actionpack/lib/action_dispatch/testing/integration.rb, line 459
def default_url_options
  reset! unless integration_session
  integration_session.default_url_options
end
default_url_options=(options)
# File actionpack/lib/action_dispatch/testing/integration.rb, line 464
def default_url_options=(options)
  reset! unless integration_session
  integration_session.default_url_options = options
end
method_missing(sym, *args, &block)

Delegate unhandled messages to the current session instance.

# File actionpack/lib/action_dispatch/testing/integration.rb, line 474
def method_missing(sym, *args, &block)
  reset! unless integration_session
  if integration_session.respond_to?(sym)
    integration_session.__send__(sym, *args, &block).tap do
      copy_session_variables!
    end
  else
    super
  end
end
open_session()

Open a new session instance. If a block is given, the new session is yielded to the block before being returned.

session = open_session do |sess|
  sess.extend(CustomAssertions)
end

By default, a single session is automatically created for you, but you can use this method to open multiple sessions that ought to be tested simultaneously.

# File actionpack/lib/action_dispatch/testing/integration.rb, line 444
def open_session
  dup.tap do |session|
    yield session if block_given?
  end
end
reset!()

Reset the current session. This is useful for testing multiple sessions in a single test case.

# File actionpack/lib/action_dispatch/testing/integration.rb, line 397
def reset!
  @integration_session = create_session(app)
end
respond_to?(method, include_private = false)
# File actionpack/lib/action_dispatch/testing/integration.rb, line 469
def respond_to?(method, include_private = false)
  integration_session.respond_to?(method, include_private) || super
end