diff options
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 19 | ||||
-rw-r--r-- | actionpack/test/controller/multipart_progress_testx.rb (renamed from actionpack/test/controller/multipart_progress_test.rb) | 0 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 19 | ||||
-rw-r--r-- | actionpack/test/controller/upload_progress_testx.rb (renamed from actionpack/test/controller/upload_progress_test.rb) | 0 | ||||
-rw-r--r-- | actionpack/test/template/upload_progress_helper_testx.rb (renamed from actionpack/test/template/upload_progress_helper_test.rb) | 0 |
5 files changed, 29 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 1092a860c9..f1762e507f 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -31,8 +31,8 @@ module ActionController #:nodoc: def reset_session @session = {} - end - + end + def port=(number) @env["SERVER_PORT"] = number.to_i end @@ -72,11 +72,19 @@ module ActionController #:nodoc: extra_keys = ActionController::Routing::Routes.extra_keys(parameters) non_path_parameters = get? ? query_parameters : request_parameters parameters.each do |key, value| - if extra_keys.include?(key.to_sym) then non_path_parameters[key] = value - else path_parameters[key] = value.to_s + if extra_keys.include?(key.to_sym) + non_path_parameters[key] = value + else + path_parameters[key] = value.to_s end end - end + end + + def recycle! + self.request_parameters = {} + self.query_parameters = {} + self.path_parameters = {} + end private def initialize_containers @@ -257,6 +265,7 @@ module Test @request.session["flash"] = ActionController::Flash::FlashHash.new.update(flash) if flash build_request_uri(action, parameters) @controller.process(@request, @response) + # @request.recycle! end # execute the request simulating a specific http method and set/volley the response diff --git a/actionpack/test/controller/multipart_progress_test.rb b/actionpack/test/controller/multipart_progress_testx.rb index ed2bdc9f6c..ed2bdc9f6c 100644 --- a/actionpack/test/controller/multipart_progress_test.rb +++ b/actionpack/test/controller/multipart_progress_testx.rb diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 6a940ee2e4..996c3c6cc2 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -8,8 +8,8 @@ class TestTest < Test::Unit::TestCase def test_params render :text => params.inspect - end - + end + def test_uri render :text => request.request_uri end @@ -33,6 +33,10 @@ class TestTest < Test::Unit::TestCase </html> HTML end + + def test_only_one_param + render :text => (@params[:left] && @params[:right]) ? "EEP, Both here!" : "OK" + end end def setup @@ -49,8 +53,8 @@ HTML def test_process_without_flash process :set_flash assert_flash_equal "><", "test" - end - + end + def test_process_with_flash process :set_flash, nil, nil, { "test" => "value" } assert_flash_equal ">value<", "test" @@ -70,6 +74,13 @@ HTML @request.set_REQUEST_URI "/explicit/uri" process :test_uri, :id => 7 assert_equal "/explicit/uri", @response.body + end + + def test_multiple_calls + process :test_only_one_param, :left => true + assert_equal "OK", @response.body + process :test_only_one_param, :right => true + assert_equal "OK", @response.body end def test_assert_tag diff --git a/actionpack/test/controller/upload_progress_test.rb b/actionpack/test/controller/upload_progress_testx.rb index 48b4251f1d..48b4251f1d 100644 --- a/actionpack/test/controller/upload_progress_test.rb +++ b/actionpack/test/controller/upload_progress_testx.rb diff --git a/actionpack/test/template/upload_progress_helper_test.rb b/actionpack/test/template/upload_progress_helper_testx.rb index 287516b765..287516b765 100644 --- a/actionpack/test/template/upload_progress_helper_test.rb +++ b/actionpack/test/template/upload_progress_helper_testx.rb |