@@ -357,6 +357,32 @@ def get_ivar_from_args(opts)
357357 let ( :promise2 ) { Promise . new ( executor : :immediate ) { 2 } }
358358 let ( :promise3 ) { Promise . new ( executor : :immediate ) { [ 3 ] } }
359359
360+ it 'executes the returned Promise by default' do
361+ composite = promise1 . zip ( promise2 , promise3 )
362+
363+ expect ( composite ) . to be_fulfilled
364+ end
365+
366+ it 'executes the returned Promise when execute is true' do
367+ composite = promise1 . zip ( promise2 , promise3 , execute : true )
368+
369+ expect ( composite ) . to be_fulfilled
370+ end
371+
372+ it 'does not execute the returned Promise when execute is false' do
373+ composite = promise1 . zip ( promise2 , promise3 , execute : false )
374+
375+ expect ( composite ) . to be_unscheduled
376+ end
377+
378+ it 'allows setting executor for Promise chain' do
379+ new_executor = Concurrent ::SingleThreadExecutor . new
380+ promise = promise1 . zip ( promise2 , promise3 , executor : new_executor )
381+
382+ promise = promise . instance_variable_get ( :@parent ) until promise . send ( :root? )
383+ expect ( promise . instance_variable_get ( :@executor ) ) . to be ( new_executor )
384+ end
385+
360386 it 'yields the results as an array' do
361387 composite = promise1 . zip ( promise2 , promise3 ) . execute . wait
362388
@@ -375,6 +401,32 @@ def get_ivar_from_args(opts)
375401 let ( :promise2 ) { Promise . new ( executor : :immediate ) { 2 } }
376402 let ( :promise3 ) { Promise . new ( executor : :immediate ) { [ 3 ] } }
377403
404+ it 'executes the returned Promise by default' do
405+ composite = Promise . zip ( promise1 , promise2 , promise3 )
406+
407+ expect ( composite ) . to be_fulfilled
408+ end
409+
410+ it 'executes the returned Promise when execute is true' do
411+ composite = Promise . zip ( promise1 , promise2 , promise3 , execute : true )
412+
413+ expect ( composite ) . to be_fulfilled
414+ end
415+
416+ it 'does not execute the returned Promise when execute is false' do
417+ composite = Promise . zip ( promise1 , promise2 , promise3 , execute : false )
418+
419+ expect ( composite ) . to be_unscheduled
420+ end
421+
422+ it 'allows setting executor for Promise chain' do
423+ new_executor = Concurrent ::SingleThreadExecutor . new
424+ promise = Promise . zip ( promise1 , promise2 , promise3 , executor : new_executor )
425+
426+ promise = promise . instance_variable_get ( :@parent ) until promise . send ( :root? )
427+ expect ( promise . instance_variable_get ( :@executor ) ) . to be ( new_executor )
428+ end
429+
378430 it 'yields the results as an array' do
379431 composite = Promise . zip ( promise1 , promise2 , promise3 ) . execute . wait
380432
0 commit comments