From ead2593a54223498647555171e930f9cbe08759c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 22 Dec 2011 18:52:42 -0700 Subject: adding an integration test for splat regexp substitutions. fixes #4138 --- actionpack/test/controller/routing_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 715010d7f7..53a50898c5 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -148,6 +148,19 @@ class LegacyRouteSetTests < Test::Unit::TestCase assert_equal 'foo', get(URI('http://example.org/hello')) end + def test_non_greedy_glob_regexp + params = nil + rs.draw do + get '/posts/:id(/*filters)', :constraints => { :filters => /.+?/ }, + :to => lambda { |e| + params = e["action_dispatch.request.path_parameters"] + [200, {}, ['foo']] + } + end + assert_equal 'foo', get(URI('http://example.org/posts/1/foo.js')) + assert_equal({:id=>"1", :filters=>"foo", :format=>"js"}, params) + end + def test_draw_with_block_arity_one_raises assert_raise(RuntimeError) do @rs.draw { |map| map.match '/:controller(/:action(/:id))' } -- cgit v1.2.3