Permalink
Browse files

Uncommented request.recycle! as it breaks more than it fixes, left te…

…st case in, xal?

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1572 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 4cd5b05 commit 524d1b5e044f8e104ac9b72290d832246c79bcd1 @dhh dhh committed Jun 30, 2005
@@ -31,8 +31,8 @@ def initialize(query_parameters = nil, request_parameters = nil, session = nil)
def reset_session
@session = {}
- end
-
+ end
+
def port=(number)
@env["SERVER_PORT"] = number.to_i
end
@@ -72,11 +72,19 @@ def assign_parameters(controller_path, action, parameters)
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 @@ def process(action, parameters = nil, session = nil, flash = nil)
@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
@@ -8,8 +8,8 @@ def set_flash
def test_params
render :text => params.inspect
- end
-
+ end
+
def test_uri
render :text => request.request_uri
end
@@ -33,6 +33,10 @@ def test_html_output
</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 @@ def teardown
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 @@ def test_process_with_request_uri_with_params_with_explicit_uri
@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

0 comments on commit 524d1b5

Please sign in to comment.