Skip to content

Commit

Permalink
group things that are alike
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 4, 2012
1 parent 9f4dafb commit 4f2cd3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions actionpack/lib/action_controller/metal/testing.rb
Expand Up @@ -17,6 +17,9 @@ def set_response!(request)


def recycle! def recycle!
@_url_options = nil @_url_options = nil
self.response_body = nil
self.formats = nil
self.params = nil
end end
end end


Expand Down
17 changes: 7 additions & 10 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -467,11 +467,14 @@ def process(action, http_method = 'GET', *args)
# proper params, as is the case when engaging rack. # proper params, as is the case when engaging rack.
parameters = paramify_values(parameters) if html_format?(parameters) 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! @request.recycle!
@response.recycle! @response.recycle!
@controller.response_body = nil @controller.recycle!
@controller.formats = nil
@controller.params = nil


@html_document = nil @html_document = nil
@request.env['REQUEST_METHOD'] = http_method @request.env['REQUEST_METHOD'] = http_method
Expand All @@ -492,12 +495,6 @@ def process(action, http_method = 'GET', *args)


build_request_uri(action, parameters) 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] name = @request.parameters[:action]


@controller.process(name) @controller.process(name)
Expand Down Expand Up @@ -535,7 +532,7 @@ def setup_controller_request_and_response
setup :setup_controller_request_and_response setup :setup_controller_request_and_response
end end


private private
def check_required_ivars def check_required_ivars
# Sanity check for required instance variables so we can give an # Sanity check for required instance variables so we can give an
# understandable error message. # understandable error message.
Expand Down

0 comments on commit 4f2cd3e

Please sign in to comment.