From 6f530de9443a4e2ab3d193624ff6ecd3c2b06de2 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 19 Aug 2008 20:15:51 -0500 Subject: Test coverage for integration testing with parameters --- actionpack/test/controller/integration_test.rb | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index b878962df3..a5373912f5 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -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| -- cgit v1.2.3