module ActionDispatch::Integration::Runner

Included modules:
ActionDispatch::Assertions

Constants

APP_SESSIONS

Attributes

app[R]

Public Class Methods

new(*args, &blk) Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 398
def initialize(*args, &blk)
  super(*args, &blk)
  @integration_session = nil
end
Calls superclass method

Public Instance Methods

create_session(app) Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 418
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() Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 472
def default_url_options
  integration_session.default_url_options
end
default_url_options=(options) Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 476
def default_url_options=(options)
  integration_session.default_url_options = options
end
integration_session() Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 408
def integration_session
  @integration_session ||= create_session(app)
end
method_missing(sym, *args, &block) Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 485
def method_missing(sym, *args, &block)
  if integration_session.respond_to?(sym)
    integration_session.__send__(sym, *args, &block).tap do
      copy_session_variables!
    end
  else
    super
  end
end

Delegate unhandled messages to the current session instance.

Calls superclass method
open_session() { |session| ... } Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 458
def open_session
  dup.tap do |session|
    yield session if block_given?
  end
end

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.

reset!() Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 414
def reset!
  @integration_session = create_session(app)
end

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

respond_to?(method, include_private = false) Show source
# File actionpack/lib/action_dispatch/testing/integration.rb, line 480
def respond_to?(method, include_private = false)
  integration_session.respond_to?(method, include_private) || super
end
Calls superclass method

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.