diff options
author | Ryan T. Hosford <tad.hosford@gmail.com> | 2016-03-03 00:43:18 -0600 |
---|---|---|
committer | Ryan T. Hosford <tad.hosford@gmail.com> | 2016-03-13 19:51:49 -0500 |
commit | b43158afba7fb4de6a3530d4f4e940f0c89bd057 (patch) | |
tree | 71291d8d0c30228e458fd39d126c4e4d2bd61191 /actionpack/test/controller/live_stream_test.rb | |
parent | 7b96d860fd91e1802c5832cd97f54fda5368df2d (diff) | |
download | rails-b43158afba7fb4de6a3530d4f4e940f0c89bd057.tar.gz rails-b43158afba7fb4de6a3530d4f4e940f0c89bd057.tar.bz2 rails-b43158afba7fb4de6a3530d4f4e940f0c89bd057.zip |
Fixes #23964
- Adds #each_chunk to ActionDispatch::Response. it's a method which
will be called by ActionDispatch::Response#each.
- Make Response#each a proper method instead of delegating to @stream
- In Live, instead of overriding #each, override #each_chunk.
- `#each` should just spit out @str_body if it's already set
- Adds #test_set_header_after_read_body_during_action
to prove this fixes #23964
- Adds #test_each_isnt_called_if_str_body_is_written to
ensure #each_chunk is not called when @str_body is available
- Call `@response.sent!` in AC::TestCase's #perform so a test response
acts a bit more like a real response. Makes test that call `#assert_stream_closed`
pass again.
- Additionally assert `#committed?` in `#assert_stream_closed`
- Make test that was calling @response.stream.each pass again by
calling @response.each instead.
Diffstat (limited to 'actionpack/test/controller/live_stream_test.rb')
-rw-r--r-- | actionpack/test/controller/live_stream_test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 0c3884cd38..298e12722b 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -246,7 +246,8 @@ module ActionController def assert_stream_closed assert response.stream.closed?, 'stream should be closed' - assert response.sent?, 'stream should be sent' + assert response.committed?, 'response should be committed' + assert response.sent?, 'response should be sent' end def capture_log_output |