@@ -573,6 +573,46 @@ class Create < Trailblazer::Operation
573573 it { assert_call Memo ::Operation ::Create , seq : "[:model, :update, :log_error]" , update : false , terminus : :failure }
574574 end
575575
576+ # Test 2.1 behavior.
577+ class WrapWithBlockReturnSignatureCheckTest_2_1 < Minitest ::Spec
578+ Memo = Module . new
579+ module Memo ::Operation
580+ end
581+
582+ #:handler-with-signature-evaluator-2-1
583+ class HandleUnsafeProcess
584+ def self . call ( ( ctx , flow_options ) , **circuit_options , &block )
585+ signal , ( ctx , flow_options ) = yield
586+
587+ evaluated_signal = if signal . to_h [ :semantic ] == :success
588+ Trailblazer ::Operation ::Railway . pass_fast!
589+ else
590+ Trailblazer ::Operation ::Railway . fail!
591+ end
592+ return evaluated_signal , [ ctx , flow_options ]
593+ end
594+ end
595+ #:handler-with-signature-evaluator-2-1 end
596+
597+ #:transaction-2-1
598+ module Memo ::Operation
599+ class Create < Trailblazer ::Operation
600+ step :model
601+ step Wrap ( HandleUnsafeProcess ) {
602+ step :update
603+ } , fast_track : true # because Wrap can return pass_fast! now
604+ step :notify
605+ left :log_error
606+ #~methods
607+ include T . def_steps ( :model , :update , :notify , :log_error )
608+ #~methods end
609+ end
610+ end
611+ #:transaction-2-1 end
612+
613+ it { assert_call Memo ::Operation ::Create , seq : "[:model, :update]" , terminus : :pass_fast }
614+ it { assert_call Memo ::Operation ::Create , seq : "[:model, :update, :log_error]" , update : false , terminus : :failure }
615+ end
576616
577617 class WrapOperationWithCustomTerminus < Minitest ::Spec
578618 Song = Module . new
0 commit comments