module ActionDispatch::RoutingVerbs

Public Instance Methods

delete(uri_or_host, path = nil) click to toggle source
# File actionpack/test/abstract_unit.rb, line 293
def delete(uri_or_host, path = nil)
  send_request(uri_or_host, "DELETE", path)[2].join
end
get(uri_or_host, path = nil) click to toggle source
# File actionpack/test/abstract_unit.rb, line 281
def get(uri_or_host, path = nil)
  send_request(uri_or_host, "GET", path)[2].join
end
patch(uri_or_host, path = nil) click to toggle source
# File actionpack/test/abstract_unit.rb, line 297
def patch(uri_or_host, path = nil)
  send_request(uri_or_host, "PATCH", path)[2].join
end
post(uri_or_host, path = nil) click to toggle source
# File actionpack/test/abstract_unit.rb, line 285
def post(uri_or_host, path = nil)
  send_request(uri_or_host, "POST", path)[2].join
end
put(uri_or_host, path = nil) click to toggle source
# File actionpack/test/abstract_unit.rb, line 289
def put(uri_or_host, path = nil)
  send_request(uri_or_host, "PUT", path)[2].join
end
request_path_params(path, options = {}) click to toggle source
# File actionpack/test/abstract_unit.rb, line 271
def request_path_params(path, options = {})
  method = options[:method] || "GET"
  resp = send_request URI("http://localhost" + path), method.to_s.upcase, nil
  status = resp.first
  if status == 404
    raise ActionController::RoutingError, "No route matches #{path.inspect}"
  end
  controller.request.path_parameters
end
send_request(uri_or_host, method, path) click to toggle source
# File actionpack/test/abstract_unit.rb, line 260
def send_request(uri_or_host, method, path)
  host = uri_or_host.host unless path
  path ||= uri_or_host.path

  params = { "PATH_INFO" => path,
             "REQUEST_METHOD" => method,
             "HTTP_HOST" => host }

  routes.call(params)
end