aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/live_response_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/live_response_test.rb')
-rw-r--r--actionpack/test/dispatch/live_response_test.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/test/dispatch/live_response_test.rb b/actionpack/test/dispatch/live_response_test.rb
index 512f3a8a7a..55becc1c91 100644
--- a/actionpack/test/dispatch/live_response_test.rb
+++ b/actionpack/test/dispatch/live_response_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/concurrency/latch'
+require 'concurrent/atomics'
module ActionController
module Live
@@ -27,18 +27,18 @@ module ActionController
end
def test_parallel
- latch = ActiveSupport::Concurrency::Latch.new
+ latch = Concurrent::CountDownLatch.new
t = Thread.new {
@response.stream.write 'foo'
- latch.await
+ latch.wait
@response.stream.close
}
@response.await_commit
@response.each do |part|
assert_equal 'foo', part
- latch.release
+ latch.count_down
end
assert t.join
end
@@ -62,15 +62,15 @@ module ActionController
def test_headers_cannot_be_written_after_webserver_reads
@response.stream.write 'omg'
- latch = ActiveSupport::Concurrency::Latch.new
+ latch = Concurrent::CountDownLatch.new
t = Thread.new {
- @response.stream.each do |chunk|
- latch.release
+ @response.stream.each do
+ latch.count_down
end
}
- latch.await
+ latch.wait
assert @response.headers.frozen?
e = assert_raises(ActionDispatch::IllegalStateError) do
@response.headers['Content-Length'] = "zomg"
@@ -83,6 +83,8 @@ module ActionController
def test_headers_cannot_be_written_after_close
@response.stream.close
+ # we can add data until it's actually written, which happens on `each`
+ @response.each { |x| }
e = assert_raises(ActionDispatch::IllegalStateError) do
@response.headers['Content-Length'] = "zomg"