Methods

Included Modules

Constants

APP_SESSIONS = {}

Attributes

[R] app

Class Public methods

new(*args, &blk)

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 342
      def initialize(*args, &blk)
        super(*args, &blk)
        @integration_session = nil
      end
🔎 See on GitHub

Instance Public methods

create_session(app)

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 362
      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) && app.routes.is_a?(ActionDispatch::Routing::RouteSet)
            include app.routes.url_helpers
            include app.routes.mounted_helpers
          end
        }
        klass.new(app)
      end
🔎 See on GitHub

default_url_options()

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 428
      def default_url_options
        integration_session.default_url_options
      end
🔎 See on GitHub

default_url_options=(options)

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 432
      def default_url_options=(options)
        integration_session.default_url_options = options
      end
🔎 See on GitHub

integration_session()

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 352
      def integration_session
        @integration_session ||= create_session(app)
      end
🔎 See on GitHub

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.

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 404
      def open_session
        dup.tap do |session|
          session.reset!
          session.root_session = self.root_session || self
          yield session if block_given?
        end
      end
🔎 See on GitHub

reset!()

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

📝 Source code
# File actionpack/lib/action_dispatch/testing/integration.rb, line 358
      def reset!
        @integration_session = create_session(app)
      end
🔎 See on GitHub