diff --git a/lib/trailblazer/macro/strategy.rb b/lib/trailblazer/macro/strategy.rb index c40a84c..c7dcd1a 100644 --- a/lib/trailblazer/macro/strategy.rb +++ b/lib/trailblazer/macro/strategy.rb @@ -4,7 +4,7 @@ module Macro class Strategy # We want to look like a real {Linear::Strategy}. class << self extend Forwardable - def_delegators :block_activity, :step, :pass, :fail # TODO: add all DSL::Helper + def_delegators :block_activity, :step, :pass, :fail, :Subprocess # TODO: add all DSL::Helper end # This makes {Wrap} look like {block_activity}. diff --git a/test/docs/wrap_test.rb b/test/docs/wrap_test.rb index cf2d5ec..5dd01e7 100644 --- a/test/docs/wrap_test.rb +++ b/test/docs/wrap_test.rb @@ -661,6 +661,19 @@ class MyValidation < Trailblazer::Activity::Railway #@ the patched version only runs {mock_validation}. assert_invoke patched_activity, seq: %{[:mock_validation]} + + # Patch Wrap/Subprocess/step, put step after {validate} + patched_activity = Trailblazer::Activity::DSL::Linear::Patch.call( + activity, + ["Wrap/WrapUnitTest::HandleUnsafeProcess", :validation], + -> { step mock_validation } + ) + + #@ the original activity with Wrap is unchanged. + assert_invoke activity, seq: %{[:validate]} + + #@ the patched version only runs {mock_validation}. + assert_invoke patched_activity, seq: %{[:validate, :mock_validation]} end end