diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-03-17 10:49:07 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-03-17 10:49:07 -0700 |
commit | ba3ad256c6d33aa7789319666d4cef4e7210758c (patch) | |
tree | 20143d600e6ce9c6967189229fbe62996b163ce3 /actionpack/test | |
parent | 8ba60912ca42a66cb59a31346623a6f9d2439192 (diff) | |
parent | 933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d (diff) | |
download | rails-ba3ad256c6d33aa7789319666d4cef4e7210758c.tar.gz rails-ba3ad256c6d33aa7789319666d4cef4e7210758c.tar.bz2 rails-ba3ad256c6d33aa7789319666d4cef4e7210758c.zip |
Merge pull request #14090 from Fortisque/kevin/stream_error_in_main_thread_if_not_committed
re-raise error if error occurs before committing in streaming
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/live_stream_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 2fd5c930ba..947f64176b 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -153,6 +153,11 @@ module ActionController render 'doesntexist' end + def exception_in_view_after_commit + response.stream.write "" + render 'doesntexist' + end + def exception_with_callback response.headers['Content-Type'] = 'text/event-stream' @@ -269,6 +274,13 @@ module ActionController assert_raises(ActionView::MissingTemplate) do get :exception_in_view end + + capture_log_output do |output| + get :exception_in_view_after_commit + assert_match %r((window\.location = "/500\.html"</script></html>)$), response.body + assert_match 'Missing template test/doesntexist', output.rewind && output.read + assert_stream_closed + end assert response.body assert_stream_closed end @@ -277,6 +289,13 @@ module ActionController assert_raises(ActionView::MissingTemplate) do get :exception_in_view, format: :json end + + capture_log_output do |output| + get :exception_in_view_after_commit, format: :json + assert_equal '', response.body + assert_match 'Missing template test/doesntexist', output.rewind && output.read + assert_stream_closed + end end def test_exception_callback_when_committed |