Permalink
Browse files

assing the request on the response only once

  • Loading branch information...
1 parent 4f2cd3e commit 5ee27630f79588f9e97c4bd1c55184b9f3616d25 @tenderlove tenderlove committed Jul 4, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 actionpack/lib/action_controller/test_case.rb
View
9 actionpack/lib/action_controller/test_case.rb
@@ -467,6 +467,8 @@ def process(action, http_method = 'GET', *args)
# proper params, as is the case when engaging rack.
parameters = paramify_values(parameters) if html_format?(parameters)
+ @html_document = nil
+
unless @controller.respond_to?(:recycle!)
@controller.extend(Testing::Functional)
@controller.class.class_eval { include Testing }
@@ -476,7 +478,6 @@ def process(action, http_method = 'GET', *args)
@response.recycle!
@controller.recycle!
- @html_document = nil
@request.env['REQUEST_METHOD'] = http_method
parameters ||= {}
@@ -489,7 +490,6 @@ def process(action, http_method = 'GET', *args)
@request.session.update(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
- @response.request = @request
@controller.request = @request
@controller.response = @response
@@ -510,8 +510,9 @@ def process(action, http_method = 'GET', *args)
end
def setup_controller_request_and_response
- @request = TestRequest.new
- @response = TestResponse.new
+ @request = TestRequest.new
+ @response = TestResponse.new
+ @response.request = @request
if klass = self.class.controller_class
@controller ||= klass.new rescue nil

0 comments on commit 5ee2763

Please sign in to comment.