Skip to content

Commit

Permalink
Merge pull request #10785 from senny/10782_routes_inspector_deals_wit…
Browse files Browse the repository at this point in the history
…h_controller_regexp

`RoutesInspector` deals with routes using regexp as `:controller` option
  • Loading branch information
rafaelfranca committed May 30, 2013
1 parent 6f70463 commit decfa35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/inspector.rb
Expand Up @@ -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?
Expand Down
9 changes: 9 additions & 0 deletions actionpack/test/dispatch/routing/inspector_test.rb
Expand Up @@ -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 decfa35

Please sign in to comment.