提交 e136fbd7 编写于 作者: A Aaron Patterson

push the cookie writing stuff out of the controller

merging cookies is responsibility of the test runner
上级 4528cd0f
......@@ -4,33 +4,12 @@ module Testing
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
......
......@@ -499,8 +499,14 @@ def process(action, http_method = 'GET', *args)
@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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册