aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-05-30 08:39:57 +0200
committerYves Senn <yves.senn@gmail.com>2013-05-30 08:39:57 +0200
commit88e8e951a283823c8e84d6b7f2e13b5cb8974a72 (patch)
tree4fadad67126674497ab58bb8fbc54b2d340cf2db /actionpack
parentc2f3efffd905f8f21eb5ea88687b738fe8a119a2 (diff)
downloadrails-88e8e951a283823c8e84d6b7f2e13b5cb8974a72.tar.gz
rails-88e8e951a283823c8e84d6b7f2e13b5cb8974a72.tar.bz2
rails-88e8e951a283823c8e84d6b7f2e13b5cb8974a72.zip
`RoutesInspector` deals with routes using regexp as `:controller` option
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/inspector.rb2
-rw-r--r--actionpack/test/dispatch/routing/inspector_test.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb
index d251de33df..cffb814e1e 100644
--- a/actionpack/lib/action_dispatch/routing/inspector.rb
+++ b/actionpack/lib/action_dispatch/routing/inspector.rb
@@ -69,7 +69,7 @@ module ActionDispatch
end
def internal?
- controller =~ %r{\Arails/(info|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}}
+ controller.to_s =~ %r{\Arails/(info|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}}
end
def engine?
diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb
index 234ae5764f..4f97d28d2b 100644
--- a/actionpack/test/dispatch/routing/inspector_test.rb
+++ b/actionpack/test/dispatch/routing/inspector_test.rb
@@ -234,6 +234,15 @@ module ActionDispatch
" PUT /posts/:id(.:format) posts#update",
" DELETE /posts/:id(.:format) posts#destroy"], output
end
+
+ def test_regression_route_with_controller_regexp
+ output = draw do
+ get ':controller(/:action)', controller: /api\/[^\/]+/, format: false
+ end
+
+ assert_equal ["Prefix Verb URI Pattern Controller#Action",
+ " GET /:controller(/:action) (?-mix:api\\/[^\\/]+)#:action"], output
+ end
end
end
end