Permalink
Browse files

Merge pull request #10785 from senny/10782_routes_inspector_deals_wit…

…h_controller_regexp

`RoutesInspector` deals with routes using regexp as `:controller` option
  • Loading branch information...
2 parents c2f3eff + 88e8e95 commit 6a6eae200d584ce059cff0496675ef382ff5303d @rafaelfranca rafaelfranca committed May 30, 2013
@@ -69,7 +69,7 @@ def action
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?
@@ -234,6 +234,15 @@ def test_routes_can_be_filtered
" 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

0 comments on commit 6a6eae2

Please sign in to comment.