aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-29 15:26:12 +0900
committerGitHub <noreply@github.com>2017-08-29 15:26:12 +0900
commit0a1e353c43e3e2195baaac15dde9422579ab7ea6 (patch)
treeeabf883a7adefe9f2d40986399fa7d9f6ca26250 /actionpack/test
parentd3e7dc6f16d68492a159d874f72a3a229a62f844 (diff)
parentfe4753fac87317180c1dadfa07112bbe9f72aaf5 (diff)
downloadrails-0a1e353c43e3e2195baaac15dde9422579ab7ea6.tar.gz
rails-0a1e353c43e3e2195baaac15dde9422579ab7ea6.tar.bz2
rails-0a1e353c43e3e2195baaac15dde9422579ab7ea6.zip
Merge pull request #30433 from y-yagi/fix_cant_modify_forzen_string_error_in_debug_locks
Fix `can't modify frozen String` error in `DebugLocks`
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/debug_locks_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/debug_locks_test.rb b/actionpack/test/dispatch/debug_locks_test.rb
new file mode 100644
index 0000000000..d69614bd79
--- /dev/null
+++ b/actionpack/test/dispatch/debug_locks_test.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require "abstract_unit"
+
+class DebugLocksTest < ActionDispatch::IntegrationTest
+ setup do
+ build_app
+ end
+
+ def test_render_threads_status
+ thread_ready = Concurrent::CountDownLatch.new
+ test_terminated = Concurrent::CountDownLatch.new
+
+ thread = Thread.new do
+ ActiveSupport::Dependencies.interlock.running do
+ thread_ready.count_down
+ test_terminated.wait
+ end
+ end
+
+ thread_ready.wait
+
+ get "/rails/locks"
+
+ test_terminated.count_down
+
+ assert_match(/Thread.*?Sharing/, @response.body)
+ ensure
+ thread.join
+ end
+
+ private
+ def build_app
+ @app = self.class.build_app do |middleware|
+ middleware.use ActionDispatch::DebugLocks
+ end
+ end
+end