diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-02 15:14:55 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-03 14:59:32 -0700 |
commit | e136fbd7fa3286006766b59485a0e3348c776e5c (patch) | |
tree | c02c8a916c4b98c824d90b5a153ed667feff82c5 /actionpack | |
parent | 4528cd0f4372a74417ecbecf82e02bc6a3550825 (diff) | |
download | rails-e136fbd7fa3286006766b59485a0e3348c776e5c.tar.gz rails-e136fbd7fa3286006766b59485a0e3348c776e5c.tar.bz2 rails-e136fbd7fa3286006766b59485a0e3348c776e5c.zip |
push the cookie writing stuff out of the controller
merging cookies is responsibility of the test runner
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/testing.rb | 25 | ||||
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 6 |
2 files changed, 8 insertions, 23 deletions
diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb index 838da3322d..f998efb6e9 100644 --- a/actionpack/lib/action_controller/metal/testing.rb +++ b/actionpack/lib/action_controller/metal/testing.rb @@ -4,33 +4,12 @@ module ActionController include RackDelegation - # 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 - - def recycled? - true - end - end - - def recycled? # :nodoc: - false + def set_response!(request) + super unless @_response end def recycle! @_url_options = nil - extend Recycled unless recycled? end # TODO : Rewrite tests using controller.headers= to use Rack env diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 480297368f..91814bbcb4 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -499,8 +499,14 @@ module ActionController @controller.recycle! name = @request.parameters[:action] + @controller.process(name) + if cookies = @request.env['action_dispatch.cookies'] + cookies.write(@response) + end + @response.prepare! + @assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {} @request.session.delete('flash') if @request.session['flash'].blank? @response |