Permalink
Browse files

Reset request_parameters in TestRequest#recycle! to avoid multiple po…

…sts clobbering each other [#2271 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
1 parent c919127 commit daffa5cbddace5a68ce09808a827805ef81ddb84 Peter Marklund committed with josh Mar 24, 2009
Showing with 9 additions and 0 deletions.
  1. +1 −0 actionpack/lib/action_controller/test_process.rb
  2. +8 −0 actionpack/test/controller/test_test.rb
View
1 actionpack/lib/action_controller/test_process.rb
@@ -110,6 +110,7 @@ def assign_parameters(controller_path, action, parameters)
end
def recycle!
+ @env["action_controller.request.request_parameters"] = {}
self.query_parameters = {}
self.path_parameters = {}
@headers, @request_method, @accepts, @content_type = nil, nil, nil, nil
View
8 actionpack/test/controller/test_test.rb
@@ -515,6 +515,14 @@ def test_header_properly_reset_after_get_request
assert_nil @request.instance_variable_get("@request_method")
end
+ def test_params_reset_after_post_request
+ post :no_op, :foo => "bar"
+ assert_equal "bar", @request.params[:foo]
+ @request.recycle!
+ post :no_op
+ assert @request.params[:foo].blank?
+ end
+
%w(controller response request).each do |variable|
%w(get post put delete head process).each do |method|
define_method("test_#{variable}_missing_for_#{method}_raises_error") do

0 comments on commit daffa5c

Please sign in to comment.