We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent accacce commit 46a93b7Copy full SHA for 46a93b7
spec/concurrent/utility/timer_spec.rb
@@ -17,14 +17,14 @@ module Concurrent
17
end
18
19
it 'executes the block after the given number of seconds' do
20
- start = Time.now
21
- expected = Concurrent::AtomicFixnum.new(0)
22
- Concurrent::timer(0.5){ expected.increment }
23
- expected.value.should eq 0
24
- sleep(0.1)
25
26
- sleep(0.8)
27
- expected.value.should eq 1
+ start = Time.now.to_f
+ latch = CountDownLatch.new(1)
+ Concurrent::timer(0.5){ latch.count_down }
+ latch.count.should eq 1
+ latch.wait(0.1)
+ latch.wait(1)
+ latch.count.should eq 0
28
29
30
it 'suppresses exceptions thrown by the block' do
0 commit comments