Invoke a route directly from a url

Alex,

Try this method (adapted from the assert_routing tests):

   def path_parameters_from_path(path, request_method)
     request = ActionController::TestRequest.new({}, {}, nil)
     request.env["REQUEST_METHOD"] = request_method.to_s.upcase if
request_method
     request.path = path
     ActionController::Routing::Routes.recognize(request)
     request.path_parameters
   end

Use it like this...

   path_parameters_from_path("/books/1", :get)
   path_parameters_from_path("/books/1", :put)

-christos