File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,12 @@ def trigger_observable(observable)
126126 } . should raise_error
127127 end
128128
129- specify '#execution_interval is writeable' , :brittle do
129+ specify '#execution_interval is writeable' , :brittle , :refactored do
130130
131131 latch = CountDownLatch . new ( 1 )
132- subject = TimerTask . new ( execution_interval : 1 ) do |task |
132+ subject = TimerTask . new ( timeout_interval : 1 ,
133+ execution_interval : 1 ,
134+ run_now : true ) do |task |
133135 task . execution_interval = 3
134136 latch . count_down
135137 end
@@ -145,10 +147,12 @@ def trigger_observable(observable)
145147 subject . kill
146148 end
147149
148- specify '#execution_interval is writeable' , :brittle do
150+ specify '#timeout_interval is writeable' , :brittle , :refactored do
149151
150152 latch = CountDownLatch . new ( 1 )
151- subject = TimerTask . new ( timeout_interval : 1 , execution_interval : 0.1 ) do |task |
153+ subject = TimerTask . new ( timeout_interval : 1 ,
154+ execution_interval : 0.1 ,
155+ run_now : true ) do |task |
152156 task . timeout_interval = 3
153157 latch . count_down
154158 end
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ module Concurrent
1616 } . to raise_error ( ArgumentError )
1717 end
1818
19- it 'executes the block after the given number of seconds' , :brittle do
19+ it 'executes the block after the given number of seconds' , :brittle , :refactored do
2020 start = Time . now . to_f
2121 latch = CountDownLatch . new ( 1 )
22- Concurrent ::timer ( 0.5 ) { latch . count_down }
23- latch . count . should eq 1
24- latch . wait ( 0.1 )
25- latch . count . should eq 1
22+ Concurrent ::timer ( 0.1 ) { latch . count_down }
2623 latch . wait ( 1 )
27- latch . count . should eq 0
24+ diff = Time . now . to_f - start
25+ diff . should > 0.1
26+ diff . should < 0.5
2827 end
2928
3029 it 'suppresses exceptions thrown by the block' do
You can’t perform that action at this time.
0 commit comments