module ActionDispatch::Assertions::RoutingAssertions
def recognized_request_for(path, extras = {}, msg)
def recognized_request_for(path, extras = {}, msg) if path.is_a?(Hash) method = path[:method] path = path[:path] else method = :get end controller = @controller if defined?(@controller) request = ActionController::TestRequest.create controller&.class if path.include?("://") fail_on(URI::InvalidURIError, msg) do uri = URI.parse(path) request.env["rack.url_scheme"] = uri.scheme || "http" request.host = uri.host if uri.host request.port = uri.port if uri.port request.path = uri.path.to_s.empty? ? "/" : uri.path end else path = "/#{path}" unless path.start_with?("/") request.path = path end request.request_method = method if method params = fail_on(ActionController::RoutingError, msg) do @routes.recognize_path(path, method: method, extras: extras) end request.path_parameters = params.with_indifferent_access request end