diff options
author | schneems <richard.schneeman@gmail.com> | 2013-01-18 15:18:23 -0600 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2013-01-20 23:10:24 -0600 |
commit | 8b72d689e3df55c5e6995a637436486f0837dc8e (patch) | |
tree | 64590d7aba44f4bba2bca4abe516788a40470662 /actionpack/test/dispatch | |
parent | 2e8b3d5c9a7725911ee16d62b9f72edbaea87adb (diff) | |
download | rails-8b72d689e3df55c5e6995a637436486f0837dc8e.tar.gz rails-8b72d689e3df55c5e6995a637436486f0837dc8e.tar.bz2 rails-8b72d689e3df55c5e6995a637436486f0837dc8e.zip |
In Browser Path Matching with Javascript
When debugging routes ,it can sometimes be difficult to understand exactly how the paths are matched. This PR adds a JS based path matching widget to the `/rails/info/routes` output. You can enter in a path, and it will tell you which of the routes that path matches, while preserving order (top match wins).
The matching widget in action:
![](http://f.cl.ly/items/3A2F0v2m3m1Z1p3P3O3k/path-match.gif)
Prior to this PR the only way to check matching paths is via mental math, or typing in a path in the url bar and seeing where it goes. This feature will be an invaluable debugging tool by dramatically decreasing the time needed to check a path match.
ATP actionpack
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/routing/inspector_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb index c7dcb5a683..55221f87c4 100644 --- a/actionpack/test/dispatch/routing/inspector_test.rb +++ b/actionpack/test/dispatch/routing/inspector_test.rb @@ -21,6 +21,14 @@ module ActionDispatch inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, options[:filter]).split("\n") end + def test_json_regexp_converter + @set.draw do + get '/cart', :to => 'cart#show' + end + route = ActionDispatch::Routing::RouteWrapper.new(@set.routes.first) + assert_equal "^\\/cart(?:\\.([^\\/.?]+))?$", route.json_regexp + end + def test_displaying_routes_for_engines engine = Class.new(Rails::Engine) do def self.inspect |