File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
actionpack/test/controller Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -658,6 +658,30 @@ def test_response_buffer_do_not_respond_to_to_ary
658
658
end
659
659
end
660
660
661
+ class LiveControllerThreadTest < ActionController ::TestCase
662
+ class TestController < ActionController ::Base
663
+ include ActionController ::Live
664
+
665
+ def greet
666
+ response . headers [ "Content-Type" ] = "text/event-stream"
667
+ %w{ hello world } . each do |word |
668
+ response . stream . write word
669
+ end
670
+ response . stream . close
671
+ end
672
+ end
673
+
674
+ tests TestController
675
+
676
+ def test_thread_locals_do_not_get_reset_in_test_environment
677
+ Thread . current [ :setting ] = "aaron"
678
+
679
+ get :greet
680
+
681
+ assert_equal "aaron" , Thread . current [ :setting ]
682
+ end
683
+ end
684
+
661
685
class BufferTest < ActionController ::TestCase
662
686
def test_nil_callback
663
687
buf = ActionController ::Live ::Buffer . new nil
You can’t perform that action at this time.
0 commit comments