@@ -690,8 +690,8 @@ def update(time, old_value, new_value)
690690
691691 it 'removes all actions from the queue when :clear_actions is true' do
692692 latch = Concurrent ::CountDownLatch . new
693- subject = Agent . new ( 0 , error_mode : :fail )
694693 end_latch = Concurrent ::CountDownLatch . new
694+ subject = Agent . new ( 0 , error_mode : :fail )
695695
696696 subject . send_via ( executor ) { latch . wait ; raise StandardError }
697697 subject . send_via ( executor ) { end_latch . count_down }
@@ -707,7 +707,6 @@ def update(time, old_value, new_value)
707707 it 'does not clear the action queue when :clear_actions is false' do
708708 latch = Concurrent ::CountDownLatch . new
709709 end_latch = Concurrent ::CountDownLatch . new
710-
711710 subject = Agent . new ( 0 , error_mode : :fail )
712711
713712 subject . send_via ( executor ) { latch . wait ; raise StandardError }
@@ -723,20 +722,18 @@ def update(time, old_value, new_value)
723722
724723 it 'does not clear the action queue when :clear_actions is not given' do
725724 latch = Concurrent ::CountDownLatch . new
725+ end_latch = Concurrent ::CountDownLatch . new
726726 subject = Agent . new ( 0 , error_mode : :fail )
727727
728728 subject . send_via ( executor ) { latch . wait ; raise StandardError }
729- 5 . times { subject . send_via ( executor ) { nil } }
730-
731- queue = subject . instance_variable_get ( :@queue )
732- size = queue . size
733- expect ( size ) . to be > 0
729+ subject . send_via ( executor ) { end_latch . count_down }
734730
735731 latch . count_down
736732 10 . times { break if subject . failed? ; sleep ( 0.1 ) }
737733
738734 subject . restart ( 42 )
739- expect ( queue . size ) . to eq size -1
735+ result = end_latch . wait ( 3 )
736+ expect ( result ) . to be true
740737 end
741738
742739 it 'resumes action processing if actions are enqueued' do
0 commit comments