@@ -270,22 +270,22 @@ module Concurrent
270
270
271
271
it 'succeeds if both promises succeed' do
272
272
child = Promise . new ( executor : executor ) { 1 } .
273
- flat_map { |v | Promise . new ( executor : executor ) { v + 10 } } . execute
274
- sleep 0.1
273
+ flat_map { |v | Promise . new ( executor : executor ) { v + 10 } } . execute . wait
274
+
275
275
expect ( child . value! ) . to eq ( 11 )
276
276
end
277
277
278
278
it 'fails if the left promise fails' do
279
279
child = Promise . new ( executor : executor ) { fail } .
280
- flat_map { |v | Promise . new ( executor : executor ) { v + 10 } } . execute
281
- sleep 0.1
280
+ flat_map { |v | Promise . new ( executor : executor ) { v + 10 } } . execute . wait
281
+
282
282
expect ( child ) . to be_rejected
283
283
end
284
284
285
285
it 'fails if the right promise fails' do
286
286
child = Promise . new ( executor : executor ) { 1 } .
287
- flat_map { |v | Promise . new ( executor : executor ) { fail } } . execute
288
- sleep 0.1
287
+ flat_map { |v | Promise . new ( executor : executor ) { fail } } . execute . wait
288
+
289
289
expect ( child ) . to be_rejected
290
290
end
291
291
@@ -297,14 +297,14 @@ module Concurrent
297
297
let ( :promise3 ) { Promise . new ( executor : executor ) { [ 3 ] } }
298
298
299
299
it 'yields the results as an array' do
300
- composite = promise1 . zip ( promise2 , promise3 ) . execute
301
- sleep 0.1
300
+ composite = promise1 . zip ( promise2 , promise3 ) . execute . wait
301
+
302
302
expect ( composite . value ) . to eq ( [ 1 , 2 , [ 3 ] ] )
303
303
end
304
304
305
305
it 'fails if one component fails' do
306
- composite = promise1 . zip ( promise2 , rejected_subject , promise3 ) . execute
307
- sleep 0.1
306
+ composite = promise1 . zip ( promise2 , rejected_subject , promise3 ) . execute . wait
307
+
308
308
expect ( composite ) . to be_rejected
309
309
end
310
310
end
0 commit comments