class TestGenerationPrefix::EngineMountedAtRoot::BlogEngine

Public Class Methods

call(env) click to toggle source
# File actionpack/test/dispatch/prefix_generation_test.rb, line 362
def self.call(env)
  env["action_dispatch.routes"] = routes
  routes.call(env)
end
routes() click to toggle source
# File actionpack/test/dispatch/prefix_generation_test.rb, line 337
def self.routes
  @routes ||= begin
    routes = ActionDispatch::Routing::RouteSet.new
    routes.draw do
      get "/posts/:id", to: "posts#show", as: :post

      get "/relative_path_root",       to: redirect("")
      get "/relative_path_redirect",   to: redirect("foo")
      get "/relative_option_root",     to: redirect(path: "")
      get "/relative_option_redirect", to: redirect(path: "foo")
      get "/relative_custom_root",     to: redirect { |params, request| "" }
      get "/relative_custom_redirect", to: redirect { |params, request| "foo" }

      get "/absolute_path_root",       to: redirect("/")
      get "/absolute_path_redirect",   to: redirect("/foo")
      get "/absolute_option_root",     to: redirect(path: "/")
      get "/absolute_option_redirect", to: redirect(path: "/foo")
      get "/absolute_custom_root",     to: redirect { |params, request| "/" }
      get "/absolute_custom_redirect", to: redirect { |params, request| "/foo" }
    end

    routes
  end
end