aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-02-14 16:51:22 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-02-14 16:51:22 -0800
commit5cc47e4c1926e0806897532d5d49c35df912b28c (patch)
tree378e4a36a51a5ae5da883c55bb0da4c35609dd52 /actionpack/test
parent5843069e7ecca3e5f71f9b99280beb88b79e4c67 (diff)
downloadrails-5cc47e4c1926e0806897532d5d49c35df912b28c.tar.gz
rails-5cc47e4c1926e0806897532d5d49c35df912b28c.tar.bz2
rails-5cc47e4c1926e0806897532d5d49c35df912b28c.zip
adding tests to document behavior for #4817
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/routing_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index d403494261..ee9374cc91 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -145,6 +145,32 @@ class LegacyRouteSetTests < ActiveSupport::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 => {