Skip to content

Commit 4f70750

Browse files
Merge pull request rails#48454 from JoeDupuis/include-rack-body-in-stream-to-ary-test
Test respond_to? :to_ary directly on RackBody
2 parents d4983a9 + 7c3fc67 commit 4f70750

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

actionpack/test/controller/live_stream_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,6 @@ def ignore_client_disconnect
319319
logger.info "Work complete"
320320
latch.count_down
321321
end
322-
323-
def buffer_do_not_respond_to_to_ary
324-
response.stream.write "response.stream.respond_to? = #{response.stream.respond_to?(:to_ary)}"
325-
response.stream.close
326-
end
327322
end
328323

329324
tests TestController
@@ -603,8 +598,13 @@ def test_stale_with_etag
603598
end
604599

605600
def test_response_buffer_do_not_respond_to_to_ary
606-
get :buffer_do_not_respond_to_to_ary
607-
assert_equal "response.stream.respond_to? = false", response.body
601+
get :basic_stream
602+
# `response.to_a` wraps the response with RackBody.
603+
# RackBody is the body we return to Rack.
604+
# Therefore we want to assert directly on it.
605+
# The Rack spec requires bodies that cannot be
606+
# buffered to return false to `respond_to?(:to_ary)`
607+
assert_not response.to_a.last.respond_to? :to_ary
608608
end
609609
end
610610

0 commit comments

Comments
 (0)