Permalink
Browse files

Fix stream closing when sending file with `ActionController::Live` in…

…cluded.


Fixes #12381
  • Loading branch information...
1 parent cd4d931 commit 71d19f15171e59b5dfddd66f3fa3a234c3f7911d @laurocaetano laurocaetano committed Nov 29, 2013
View
@@ -1,3 +1,9 @@
+* Fix stream closing when sending file with `ActionController::Live` included.
+
+ Fixes #12381
+
+ *Alessandro Diaferia*
+
* Better error message for typos in assert_response argument.
When the response type argument to `assert_response` is not a known
@@ -234,7 +234,7 @@ def log_error(exception)
def response_body=(body)
super
- response.stream.close if response
+ response.close if response
end
def set_response!(request)
@@ -25,6 +25,10 @@ def data
end
end
+class SendFileWithActionControllerLive < SendFileController
+ include ActionController::Live
+end
+
class SendFileTest < ActionController::TestCase
tests SendFileController
include TestFileUtils
@@ -196,4 +200,14 @@ def test_send_file_without_content_disposition_header
assert_equal 200, @response.status
end
end
+
+ tests SendFileWithActionControllerLive
+
+ def test_send_file_with_action_controller_live
+ @controller = SendFileWithActionControllerLive.new
+ @controller.options = { :content_type => "application/x-ruby" }
+
+ response = process('file')
+ assert_equal 200, response.status
+ end
end

0 comments on commit 71d19f1

Please sign in to comment.