From 35d12ef3f15184c45b51bfab9b399fe73a7a3ce3 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 1 Mar 2015 16:20:27 +0900 Subject: fix ActionView::Template::Error when using Streaming with capture. can't acquire a encoding from StreamingBuffer. fixes #12001 --- actionview/test/fixtures/layouts/streaming_with_capture.erb | 6 ++++++ actionview/test/template/streaming_render_test.rb | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 actionview/test/fixtures/layouts/streaming_with_capture.erb (limited to 'actionview/test') diff --git a/actionview/test/fixtures/layouts/streaming_with_capture.erb b/actionview/test/fixtures/layouts/streaming_with_capture.erb new file mode 100644 index 0000000000..538c19ce3a --- /dev/null +++ b/actionview/test/fixtures/layouts/streaming_with_capture.erb @@ -0,0 +1,6 @@ +<%= yield :header -%> +<%= capture do %> + this works +<% end %> +<%= yield :footer -%> +<%= yield(:unknown).presence || "." -%> diff --git a/actionview/test/template/streaming_render_test.rb b/actionview/test/template/streaming_render_test.rb index ec537775be..d06ba4ceb0 100644 --- a/actionview/test/template/streaming_render_test.rb +++ b/actionview/test/template/streaming_render_test.rb @@ -104,4 +104,8 @@ class FiberedTest < ActiveSupport::TestCase buffered_render(:template => "test/nested_streaming", :layout => "layouts/streaming") end + def test_render_with_streaming_and_capture + assert_equal "Yes, \n this works\n like a charm.", + buffered_render(template: "test/streaming", layout: "layouts/streaming_with_capture") + end end -- cgit v1.2.3