Skip to content

Commit 9b5fcb7

Browse files
committed
Refactored brittle Future test.
1 parent 43d65ad commit 9b5fcb7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spec/concurrent/future_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ def trigger_observable(observable)
140140
future.execute
141141
end
142142

143-
it 'sets the state to :pending', :brittle do
144-
future = Future.new(executor: executor){ sleep(0.1) }
143+
it 'sets the state to :pending', :brittle, :refactored do
144+
latch = Concurrent::CountDownLatch.new(1)
145+
future = Future.new(executor: executor){ latch.wait(10) }
145146
future.execute
146147
future.should be_pending
148+
latch.count_down
147149
end
148150

149151
it 'returns self' do

0 commit comments

Comments
 (0)