aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/live_stream_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/live_stream_test.rb')
-rw-r--r--actionpack/test/controller/live_stream_test.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb
index 3ea02f0a19..1361e95081 100644
--- a/actionpack/test/controller/live_stream_test.rb
+++ b/actionpack/test/controller/live_stream_test.rb
@@ -150,6 +150,20 @@ module ActionController
response.stream.close
end
+ def write_sleep_autoload
+ path = File.join(File.dirname(__FILE__), "../fixtures")
+ ActiveSupport::Dependencies.autoload_paths << path
+
+ response.headers["Content-Type"] = "text/event-stream"
+ response.stream.write "before load"
+ sleep 0.01
+ ::LoadMe
+ response.stream.close
+ latch.count_down
+
+ ActiveSupport::Dependencies.autoload_paths.reject! { |p| p == path }
+ end
+
def thread_locals
tc.assert_equal "aaron", Thread.current[:setting]
@@ -271,7 +285,7 @@ module ActionController
def test_set_cookie
get :set_cookie
- assert_equal({"hello" => "world"}, @response.cookies)
+ assert_equal({ "hello" => "world" }, @response.cookies)
assert_equal "hello world", @response.body
end
@@ -281,6 +295,14 @@ module ActionController
assert_equal "text/event-stream", @response.headers["Content-Type"]
end
+ def test_delayed_autoload_after_write_within_interlock_hook
+ # Simulate InterlockHook
+ ActiveSupport::Dependencies.interlock.start_running
+ res = get :write_sleep_autoload
+ res.each {}
+ ActiveSupport::Dependencies.interlock.done_running
+ end
+
def test_async_stream
rubinius_skip "https://github.com/rubinius/rubinius/issues/2934"