Permalink
Browse files

push req / res setting to the test runner

Try to avoid making the controller mutate itself so that we can
eventually make the response async
  • Loading branch information...
1 parent 46eba6c commit 9eef9333bdc9631e1b0149fee86a491b603858b3 @tenderlove tenderlove committed Jul 2, 2012
Showing with 10 additions and 5 deletions.
  1. +0 −4 actionpack/lib/action_controller/metal/testing.rb
  2. +10 −1 actionpack/lib/action_controller/test_case.rb
@@ -8,12 +8,8 @@ def recycle!
@_url_options = nil
end
-
# TODO: Clean this up
def process_with_new_base_test(request, response)
- @_request = request
- @_response = response
- @_response.request = request
ret = process(request.parameters[:action])
if cookies = @_request.env['action_dispatch.cookies']
cookies.write(@_response)
@@ -490,9 +490,18 @@ def process(action, http_method = 'GET', *args)
@request.session.update(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
- @controller.request = @request
+ @response.request = @request
+ @controller.request = @request
+ @controller.response = @response
+
build_request_uri(action, parameters)
@controller.class.class_eval { include Testing }
+
+ @controller.extend(Module.new {
+ def set_response!(request)
+ end
+ })
+
@controller.recycle!
@controller.process_with_new_base_test(@request, @response)
@assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}

0 comments on commit 9eef933

Please sign in to comment.