Skip to content
Browse files

adding an integration test for splat regexp substitutions. fixes #4138

  • Loading branch information...
1 parent a32d3d0 commit 5f2bfce9e0f4e9995c341ca27320e32ae0d9880f @tenderlove tenderlove committed Dec 22, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 actionpack/test/controller/routing_test.rb
View
13 actionpack/test/controller/routing_test.rb
@@ -148,6 +148,19 @@ def test_empty_string_match
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))' }

0 comments on commit 5f2bfce

Please sign in to comment.
Something went wrong with that request. Please try again.