1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/dispatch
Andrew White d8745decaf Add support for optional root segments containing slashes
Optional segments with a root scope need to have the leading slash
outside of the parentheses, otherwise the generated url will be empty.
However if the route has non-optional elements then the leading slash
needs to remain inside the parentheses otherwise the generated url
will have two leading slashes, e.g:

Blog::Application.routes.draw do
  get '/(:category)', :to => 'posts#index', :as => :root
  get '/(:category)/author/:name', :to => 'posts#author', :as => :author
end

$ rake routes
  root GET /(:category)(.:format)              posts#index
author GET (/:category)/author/:name(.:format) posts#author

This change adds support for optional segments that contain a slash,
allowing support for urls like /page/2 for the root path, e.g:

Blog::Application.routes.draw do
  get '/(page/:page)', :to => 'posts#index', :as => :root
end

$ rake routes
root GET /(page/:page)(.:format) posts#index

Fixes #7073
2012-07-17 19:49:44 +01:00
..
middleware_stack make sure string keys are always looked up from the class cache 2011-03-02 10:11:28 -08:00
request Fix build 2012-06-13 20:21:35 -03:00
routing Rename RouteInspector to RoutesInspector 2012-07-08 13:49:15 -03:00
session testing session store behavior 2012-05-02 17:29:33 -07:00
callbacks_test.rb ActionDispatch: add missing test for callbacks 2012-02-16 15:58:58 +02:00
cookies_test.rb Dont stream back cookie value if it was set to the same value 2012-04-30 17:04:17 +04:00
debug_exceptions_test.rb Raise ActionController::BadRequest for malformed parameter hashes. 2012-05-20 19:07:04 +01:00
header_test.rb Enable ActionDispatch::Http::Headers to support fetch 2012-05-02 11:22:34 -07:00
mapper_test.rb Raise a helpful error message on #mount misuse 2012-07-10 16:17:02 -07:00
middleware_stack_test.rb Add the #unshift method to the middleware stack 2012-05-18 16:41:52 +10:00
mime_type_test.rb Prevent conflict between mime types and Object methods 2012-07-06 20:38:23 +02:00
mount_test.rb Add passing tests for generating URLs with nested SCRIPT_NAMEs 2012-05-07 14:53:57 -07:00
prefix_generation_test.rb Remove default match without specified method 2012-04-24 22:52:26 -05:00
rack_cache_test.rb Dump and load rack-cache stuff. 2011-05-17 17:33:17 -04:00
rack_test.rb * Change the object used in routing constraints to be an instance of 2010-04-03 20:24:30 -07:00
reloader_test.rb Use a BodyProxy instead of including a Module that responds to close. 2012-01-13 19:46:13 -02:00
request_id_test.rb Remove default match without specified method 2012-04-24 22:52:26 -05:00
request_test.rb Raise ActionController::BadRequest for malformed parameter hashes. 2012-05-20 19:07:04 +01:00
response_test.rb deprecate String#encoding_aware? and remove its usage 2011-12-24 15:57:54 +03:00
routing_assertions_test.rb Raise Assertion instead of RoutingError for routing assertion failures. 2012-05-20 06:21:32 -05:00
routing_test.rb Add support for optional root segments containing slashes 2012-07-17 19:49:44 +01:00
show_exceptions_test.rb Removed unused assigns from ActionView::Template::Error 2012-01-20 20:13:29 +04:00
ssl_test.rb Fix secure cookies when there are more than one space before the secure 2012-03-19 16:31:57 -03:00
static_test.rb fix ArgumentError being raised in case of invalid byte sequences 2012-03-08 20:41:25 +09:00
test_request_test.rb Fix bug when Rails.application is defined but is nil. See #881 2012-05-21 15:24:18 -04:00
test_response_test.rb Add ActionDispatch::TestResponse tests. 2010-09-25 10:52:57 +02:00
uploaded_file_test.rb adds delegetion for eof? to AD::Http::UploadedFile 2012-03-27 22:53:33 +02:00
url_generation_test.rb Add passing tests for generating URLs with nested SCRIPT_NAMEs 2012-05-07 14:53:57 -07:00