1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

make sure set_response! sets the correct response object

This commit is contained in:
Aaron Patterson 2012-07-29 19:46:36 -07:00
parent 08b107e345
commit 619e7c8db8
2 changed files with 15 additions and 0 deletions

View file

@ -111,5 +111,14 @@ module ActionController # :nodoc:
@_response.await_commit
end
def set_response!(request)
if request.env["HTTP_VERSION"] == "HTTP/1.0"
super
else
@_response = Live::Response.new
@_response.request = request
end
end
end
end

View file

@ -53,6 +53,12 @@ module ActionController
TestResponse.new
end
def test_set_response!
@controller.set_response!(@request)
assert_kind_of(Live::Response, @controller.response)
assert_equal @request, @controller.response.request
end
def test_write_to_stream
@controller = TestController.new
get :basic_stream