From 4f2cd3e9fee721d7485bb1c1b4151612d733da3a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 3 Jul 2012 17:18:31 -0700 Subject: [PATCH] group things that are alike --- .../lib/action_controller/metal/testing.rb | 3 +++ actionpack/lib/action_controller/test_case.rb | 17 +++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb index 09581d4fc9..0377b8c4cf 100644 --- a/actionpack/lib/action_controller/metal/testing.rb +++ b/actionpack/lib/action_controller/metal/testing.rb @@ -17,6 +17,9 @@ module ActionController def recycle! @_url_options = nil + self.response_body = nil + self.formats = nil + self.params = nil end end diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 210ae98f8d..ce2cd9e61c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -467,11 +467,14 @@ module ActionController # proper params, as is the case when engaging rack. parameters = paramify_values(parameters) if html_format?(parameters) + unless @controller.respond_to?(:recycle!) + @controller.extend(Testing::Functional) + @controller.class.class_eval { include Testing } + end + @request.recycle! @response.recycle! - @controller.response_body = nil - @controller.formats = nil - @controller.params = nil + @controller.recycle! @html_document = nil @request.env['REQUEST_METHOD'] = http_method @@ -492,12 +495,6 @@ module ActionController build_request_uri(action, parameters) - unless @controller.respond_to?(:recycle!) - @controller.extend(Testing::Functional) - @controller.class.class_eval { include Testing } - end - - @controller.recycle! name = @request.parameters[:action] @controller.process(name) @@ -535,7 +532,7 @@ module ActionController setup :setup_controller_request_and_response end - private + private def check_required_ivars # Sanity check for required instance variables so we can give an # understandable error message.