aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/streaming_render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test/template/streaming_render_test.rb')
-rw-r--r--actionview/test/template/streaming_render_test.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/actionview/test/template/streaming_render_test.rb b/actionview/test/template/streaming_render_test.rb
index 6ce66a1275..ef000300cc 100644
--- a/actionview/test/template/streaming_render_test.rb
+++ b/actionview/test/template/streaming_render_test.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
require "abstract_unit"
class TestController < ActionController::Base
end
-class FiberedTest < ActiveSupport::TestCase
+class SetupFiberedBase < ActiveSupport::TestCase
def setup
view_paths = ActionController::Base.view_paths
@assigns = { secret: "in the sauce", name: nil }
@@ -17,13 +19,15 @@ class FiberedTest < ActiveSupport::TestCase
def buffered_render(options)
body = render_body(options)
- string = ""
+ string = "".dup
body.each do |piece|
string << piece
end
string
end
+end
+class FiberedTest < SetupFiberedBase
def test_streaming_works
content = []
body = render_body(template: "test/hello_world", layout: "layouts/yield")
@@ -109,3 +113,20 @@ class FiberedTest < ActiveSupport::TestCase
buffered_render(template: "test/streaming", layout: "layouts/streaming_with_capture")
end
end
+
+class FiberedWithLocaleTest < SetupFiberedBase
+ def setup
+ @old_locale = I18n.locale
+ I18n.locale = "da"
+ super
+ end
+
+ def teardown
+ I18n.locale = @old_locale
+ end
+
+ def test_render_with_streaming_and_locale
+ assert_equal "layout.locale: da\nview.locale: da\n\n",
+ buffered_render(template: "test/streaming_with_locale", layout: "layouts/streaming_with_locale")
+ end
+end