aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-22 18:52:42 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-22 18:52:42 -0700
commitead2593a54223498647555171e930f9cbe08759c (patch)
tree50b8ff9dac4f072549d57f7a5fb05d94261ae66f /actionpack/test
parent4ee537a8a21ecab2a4d0c8e6a6730a72a7937428 (diff)
downloadrails-ead2593a54223498647555171e930f9cbe08759c.tar.gz
rails-ead2593a54223498647555171e930f9cbe08759c.tar.bz2
rails-ead2593a54223498647555171e930f9cbe08759c.zip
adding an integration test for splat regexp substitutions. fixes #4138
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/routing_test.rb13
1 files changed, 13 insertions, 0 deletions
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))' }