aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
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:53:09 -0700
commit5f2bfce9e0f4e9995c341ca27320e32ae0d9880f (patch)
treeea3c7b26ee24043431a807ee0d47d748da3d70b9 /actionpack/test/controller/routing_test.rb
parenta32d3d0ad9802c6c10c767506afb0aa13c6565a6 (diff)
downloadrails-5f2bfce9e0f4e9995c341ca27320e32ae0d9880f.tar.gz
rails-5f2bfce9e0f4e9995c341ca27320e32ae0d9880f.tar.bz2
rails-5f2bfce9e0f4e9995c341ca27320e32ae0d9880f.zip
adding an integration test for splat regexp substitutions. fixes #4138
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-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))' }