mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Test coverage for integration testing with parameters
This commit is contained in:
parent
5de340e79f
commit
6f530de944
1 changed files with 32 additions and 0 deletions
|
@ -259,6 +259,10 @@ class IntegrationProcessTest < ActionController::IntegrationTest
|
|||
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 @@ class IntegrationProcessTest < ActionController::IntegrationTest
|
|||
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|
|
||||
|
|
Loading…
Reference in a new issue