aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-07-02 14:29:19 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-07-03 14:59:31 -0700
commit9eef9333bdc9631e1b0149fee86a491b603858b3 (patch)
treed552f029f9d03b59301957d9813c40fc28edc6c0 /actionpack
parent46eba6c30ff05b5f7e8e6015e33ddf0a385fce6f (diff)
downloadrails-9eef9333bdc9631e1b0149fee86a491b603858b3.tar.gz
rails-9eef9333bdc9631e1b0149fee86a491b603858b3.tar.bz2
rails-9eef9333bdc9631e1b0149fee86a491b603858b3.zip
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
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/testing.rb4
-rw-r--r--actionpack/lib/action_controller/test_case.rb11
2 files changed, 10 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb
index d1813ee745..a4718376aa 100644
--- a/actionpack/lib/action_controller/metal/testing.rb
+++ b/actionpack/lib/action_controller/metal/testing.rb
@@ -8,12 +8,8 @@ module ActionController
@_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)
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index a1f29ea1bc..9c73aba22a 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -490,9 +490,18 @@ module ActionController
@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 : {}