class ShareLockTest::CustomAssertionsTest
Public Instance Methods
setup()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 518 def setup @latch = Concurrent::CountDownLatch.new @thread = Thread.new { @latch.wait } end
teardown()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 523 def teardown @latch.count_down @thread.join end
test_detects_already_released()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 545 def test_detects_already_released @latch.count_down assert_raises(Minitest::Assertion) do assert_threads_stuck_but_releasable_by_latch @thread, @latch end end
test_detects_free_thread()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 538 def test_detects_free_thread @latch.count_down assert_raises(Minitest::Assertion) do assert_threads_stuck @thread end end
test_detects_remains_latched()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 552 def test_detects_remains_latched another_latch = Concurrent::CountDownLatch.new assert_raises(Minitest::Assertion) do assert_threads_stuck_but_releasable_by_latch @thread, another_latch end end
test_detects_stuck_thread()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 532 def test_detects_stuck_thread assert_raises(Minitest::Assertion) do assert_threads_not_stuck @thread end end
test_happy_path()
click to toggle source
# File activesupport/test/share_lock_test.rb, line 528 def test_happy_path assert_threads_stuck_but_releasable_by_latch @thread, @latch end