提交 ead2593a 编写于 作者: A Aaron Patterson

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

上级 4ee537a8
......@@ -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))' }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册