123456789_123456789_123456789_123456789_123456789_

Module: ActionDispatch::Assertions::RoutingAssertions::WithIntegrationRouting

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: actionpack/lib/action_dispatch/testing/assertions/routing.rb

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Method Summary

Instance Method Details

#create_routes {|routes| ... } (private)

Yields:

  • (routes)
[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/testing/assertions/routing.rb', line 46

def create_routes
  app = self.app
  routes = ActionDispatch::Routing::RouteSet.new
  rack_app = app.config.middleware.build(routes)
  https = integration_session.https?
  host = integration_session.host

  app.instance_variable_set(:@routes, routes)
  app.instance_variable_set(:@app, rack_app)
  @integration_session = Class.new(ActionDispatch::Integration::Session) do
    include app.routes.url_helpers
    include app.routes.mounted_helpers
  end.new(app)
  @integration_session.https! https
  @integration_session.host! host
  @routes = routes

  yield routes
end

#reset_routes(old_routes, old_integration_session) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/testing/assertions/routing.rb', line 66

def reset_routes(old_routes, old_integration_session)
  old_rack_app = app.config.middleware.build(old_routes)

  app.instance_variable_set(:@routes, old_routes)
  app.instance_variable_set(:@app, old_rack_app)
  @integration_session = old_integration_session
  @routes = old_routes
end

#with_routing(&block)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/testing/assertions/routing.rb', line 37

def with_routing(&block)
  old_routes = app.routes
  old_integration_session = integration_session
  create_routes(&block)
ensure
  reset_routes(old_routes, old_integration_session)
end