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 7bc9f58 commit 54441b1Copy full SHA for 54441b1
spec/concurrent/executor/timer_set_spec.rb
@@ -92,13 +92,16 @@ module Concurrent
92
end
93
94
it 'executes tasks with different times in scheduled time' do
95
- expected = []
96
- subject.post(0.2){ expected << 2 }
97
- subject.post(0.1){ expected << 1 }
98
- sleep(0.15)
99
- expect(expected).to eq [1]
100
- sleep(0.1)
101
- expect(expected).to eq [1,2]
+ expected = Queue.new
+ subject.post(0.2) { expected << [2, Time.now] }
+ subject.post(0.1) { expected << [1, Time.now] }
+
+ number, time1 = expected.pop
+ expect(number).to eq 1
102
+ number, time2 = expected.pop
103
+ expect(number).to eq 2
104
+ expect(time2 - time1).to be > 0.01
105
106
107
it 'cancels all pending tasks on #shutdown' do
0 commit comments