module ActionDispatch::Integration::Runner
def before_setup # :nodoc:
def before_setup # :nodoc: @app = nil @integration_session = nil super end
def copy_session_variables! #:nodoc:
test instance.
Copy the instance variables from the current session instance into the
def copy_session_variables! #:nodoc: @controller = @integration_session.controller @response = @integration_session.response @request = @integration_session.request end
def create_session(app)
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
def default_url_options
def default_url_options integration_session.default_url_options end
def default_url_options=(options)
def default_url_options=(options) integration_session.default_url_options = options end
def integration_session
def integration_session @integration_session ||= create_session(app) end
def method_missing(sym, *args, &block)
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
def open_session
can use this method to open multiple sessions that ought to be tested
By default, a single session is automatically created for you, but you
end
sess.extend(CustomAssertions)
session = open_session do |sess|
yielded to the block before being returned.
Open a new session instance. If a block is given, the new session is
def open_session dup.tap do |session| yield session if block_given? end end
def remove! # :nodoc:
def remove! # :nodoc: @integration_session = nil end
def reset!
Reset the current session. This is useful for testing multiple sessions
def reset! @integration_session = create_session(app) end
def respond_to?(method, include_private = false)
def respond_to?(method, include_private = false) integration_session.respond_to?(method, include_private) || super end