diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-14 16:51:22 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-14 16:51:49 -0800 |
commit | 201e67ed365c797795df09fcb8a7bc7ecfdbb30d (patch) | |
tree | 06d2cad8ee651d28b97275aaaa822fc0ddd67799 /actionpack/test/controller | |
parent | 7c79996c6754f6d7dd67f43d279a63121ee71a9b (diff) | |
download | rails-201e67ed365c797795df09fcb8a7bc7ecfdbb30d.tar.gz rails-201e67ed365c797795df09fcb8a7bc7ecfdbb30d.tar.bz2 rails-201e67ed365c797795df09fcb8a7bc7ecfdbb30d.zip |
adding tests to document behavior for #4817
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 222497d311..03eac2c5a1 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -155,6 +155,32 @@ class LegacyRouteSetTests < Test::Unit::TestCase assert_equal 'Not Found', get(URI('http://example.org/journey/omg-faithfully')) end + def test_star_paths_are_greedy + rs.draw do + match "/(*filters)", :to => lambda { |env| + x = env["action_dispatch.request.path_parameters"][:filters] + [200, {}, [x]] + }, :format => false + end + + u = URI('http://example.org/ne_27.065938,-80.6092/sw_25.489856,-82.542794') + assert_equal u.path.sub(/^\//, ''), get(u) + end + + def test_star_paths_are_greedy_but_not_too_much + rs.draw do + match "/(*filters).:format", :to => lambda { |env| + x = JSON.dump env["action_dispatch.request.path_parameters"] + [200, {}, [x]] + } + end + + expected = { "filters" => "ne_27.065938,-80.6092/sw_25.489856,-82", + "format" => "542794" } + u = URI('http://example.org/ne_27.065938,-80.6092/sw_25.489856,-82.542794') + assert_equal expected, JSON.parse(get(u)) + end + def test_regexp_precidence @rs.draw do match '/whois/:domain', :constraints => { |