File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -368,6 +368,27 @@ def get_ivar_from_args(opts)
368
368
369
369
expect ( composite ) . to be_rejected
370
370
end
371
+
372
+ it 'preserves ordering of the executed promises' do
373
+ promise1 = Promise . execute do
374
+ # resolves after the second promise
375
+ sleep 0.2
376
+ 'one'
377
+ end
378
+
379
+ promise2 = Promise . execute do
380
+ sleep 0.1
381
+ 'two'
382
+ end
383
+
384
+ promise3 = Promise . execute do
385
+ 'three'
386
+ end
387
+
388
+ result = promise1 . zip ( promise2 , promise3 ) . value
389
+
390
+ expect ( result ) . to eql ( [ 'one' , 'two' , 'three' ] )
391
+ end
371
392
end
372
393
373
394
describe '.zip' do
@@ -386,6 +407,27 @@ def get_ivar_from_args(opts)
386
407
387
408
expect ( composite ) . to be_rejected
388
409
end
410
+
411
+ it 'preserves ordering of the executed promises' do
412
+ promise1 = Promise . execute do
413
+ # resolves after the second promise
414
+ sleep 0.2
415
+ 'one'
416
+ end
417
+
418
+ promise2 = Promise . execute do
419
+ sleep 0.1
420
+ 'two'
421
+ end
422
+
423
+ promise3 = Promise . execute do
424
+ 'three'
425
+ end
426
+
427
+ result = Promise . zip ( promise1 , promise2 , promise3 ) . value
428
+
429
+ expect ( result ) . to eql ( [ 'one' , 'two' , 'three' ] )
430
+ end
389
431
end
390
432
391
433
describe 'aggregators' do
You can’t perform that action at this time.
0 commit comments