提交 6f530de9 编写于 作者: J Joshua Peek

Test coverage for integration testing with parameters

上级 5de340e7
......@@ -259,6 +259,10 @@ def get
end
end
def get_with_params
render :text => "foo: #{params[:foo]}", :status => 200
end
def post
render :text => "Created", :status => 201
end
......@@ -362,6 +366,34 @@ def test_xml_http_request_get
end
end
def test_get_with_query_string
with_test_route_set do
get '/get_with_params?foo=bar'
assert_equal '/get_with_params?foo=bar', request.env["REQUEST_URI"]
assert_equal '/get_with_params?foo=bar', request.request_uri
assert_equal nil, request.env["QUERY_STRING"]
assert_equal 'foo=bar', request.query_string
assert_equal 'bar', request.parameters['foo']
assert_equal 200, status
assert_equal "foo: bar", response.body
end
end
def test_get_with_parameters
with_test_route_set do
get '/get_with_params', :foo => "bar"
assert_equal '/get_with_params', request.env["REQUEST_URI"]
assert_equal '/get_with_params', request.request_uri
assert_equal 'foo=bar', request.env["QUERY_STRING"]
assert_equal 'foo=bar', request.query_string
assert_equal 'bar', request.parameters['foo']
assert_equal 200, status
assert_equal "foo: bar", response.body
end
end
private
def with_test_route_set
with_routing do |set|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册