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

This commit is contained in:
Aaron Patterson
2011-12-22 18:52:42 -07:00
parent a32d3d0ad9
commit 5f2bfce9e0

View File

@@ -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))' }