aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/testing.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-07-02 14:43:56 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-07-03 14:59:31 -0700
commit4528cd0f4372a74417ecbecf82e02bc6a3550825 (patch)
tree4491b77ac08da1c6ef70b2cc80e6a6e53c75818e /actionpack/lib/action_controller/metal/testing.rb
parent9eef9333bdc9631e1b0149fee86a491b603858b3 (diff)
downloadrails-4528cd0f4372a74417ecbecf82e02bc6a3550825.tar.gz
rails-4528cd0f4372a74417ecbecf82e02bc6a3550825.tar.bz2
rails-4528cd0f4372a74417ecbecf82e02bc6a3550825.zip
extend the controller with special logic on recycle
For some reason, this special logic is only supposed to be executed on the second request. For now, we'll extend on recycle, but we should figure out why this functionality can't be run on every request
Diffstat (limited to 'actionpack/lib/action_controller/metal/testing.rb')
-rw-r--r--actionpack/lib/action_controller/metal/testing.rb35
1 files changed, 25 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb
index a4718376aa..838da3322d 100644
--- a/actionpack/lib/action_controller/metal/testing.rb
+++ b/actionpack/lib/action_controller/metal/testing.rb
@@ -4,18 +4,33 @@ module ActionController
include RackDelegation
- def recycle!
- @_url_options = nil
- end
+ # This gets included on the second request. We only want to modify this
+ # behavior on the second request. Ugh.
+ module Recycled # :nodoc:
+ def set_response!(request)
+ end
+
+ def process(name)
+ ret = super
+ if cookies = @_request.env['action_dispatch.cookies']
+ cookies.write(@_response)
+ end
+ @_response.prepare!
+ ret
+ end
- # TODO: Clean this up
- def process_with_new_base_test(request, response)
- ret = process(request.parameters[:action])
- if cookies = @_request.env['action_dispatch.cookies']
- cookies.write(@_response)
+ def recycled?
+ true
end
- @_response.prepare!
- ret
+ end
+
+ def recycled? # :nodoc:
+ false
+ end
+
+ def recycle!
+ @_url_options = nil
+ extend Recycled unless recycled?
end
# TODO : Rewrite tests using controller.headers= to use Rack env