diff --git a/lib/trailblazer/macro/strategy.rb b/lib/trailblazer/macro/strategy.rb index c7dcd1a..91db54c 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, :Subprocess # TODO: add all DSL::Helper + def_delegators :block_activity, :step, :pass, :fail, :left, :Subprocess # TODO: add all DSL::Helper end # This makes {Wrap} look like {block_activity}. diff --git a/test/docs/autogenerated/operation_each_test.rb b/test/docs/autogenerated/operation_each_test.rb index 4a4c211..62d4490 100644 --- a/test/docs/autogenerated/operation_each_test.rb +++ b/test/docs/autogenerated/operation_each_test.rb @@ -4,7 +4,7 @@ # step Macro::Each(:report_templates, key: :report_template) { # step Subprocess(ReportTemplate::Update), input: :input_report_template -# fail :set_report_template_errors +# left :set_report_template_errors # } # def report_templates(ctx, **) ctx["result.contract.default"].report_templates diff --git a/test/docs/each_test.rb b/test/docs/each_test.rb index ffb68df..c658793 100644 --- a/test/docs/each_test.rb +++ b/test/docs/each_test.rb @@ -3,7 +3,7 @@ # step Macro::Each(:report_templates, key: :report_template) { # step Subprocess(ReportTemplate::Update), input: :input_report_template -# fail :set_report_template_errors +# left :set_report_template_errors # } # def report_templates(ctx, **) ctx["result.contract.default"].report_templates diff --git a/test/docs/rescue_test.rb b/test/docs/rescue_test.rb index 4ab7a12..b3b4cb0 100644 --- a/test/docs/rescue_test.rb +++ b/test/docs/rescue_test.rb @@ -17,10 +17,10 @@ class NestedInsanity < Trailblazer::Operation step ->(options, **) { options["b"] = true } pass ->(options, **) { raise A if options["raise-a"] } step ->(options, **) { options["c"] = true } - fail ->(options, **) { options["inner-err"] = true } + left ->(options, **) { options["inner-err"] = true } } step ->(options, **) { options["e"] = true }, id: "nested/e" - fail ->(options, **) { options["outer-err"] = true }, id: "nested/failure" + left ->(options, **) { options["outer-err"] = true }, id: "nested/failure" end it { assert_match /\[>Rescue\/.{1,3},>nested/, Trailblazer::Developer.railway(NestedInsanity) } # FIXME: better introspect tests for all id-generating macros. @@ -54,7 +54,7 @@ class Song::Activity::Create < Trailblazer::Activity::Railway step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:create_model, :upload, :notify, :log_error) include Rehash @@ -91,7 +91,7 @@ class Song::Activity::Create < Trailblazer::Activity::Railway step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:create_model, :upload, :notify, :log_error) include Rehash @@ -125,7 +125,7 @@ class Memo::Create < Trailblazer::Operation step :rehash } step :notify - fail :log_error + left :log_error include T.def_steps(:find_model, :update, :notify, :log_error) include Rehash end @@ -148,7 +148,7 @@ class Memo::Create < Trailblazer::Operation step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:find_model, :update, :notify, :log_error) include Rehash @@ -180,7 +180,7 @@ class Memo::Create < Trailblazer::Operation step :find_model step Rescue(&rescue_block), fail_fast: true step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:find_model, :update, :notify, :log_error, :rehash) end diff --git a/test/docs/wrap_test.rb b/test/docs/wrap_test.rb index 86be888..85f3f73 100644 --- a/test/docs/wrap_test.rb +++ b/test/docs/wrap_test.rb @@ -26,7 +26,7 @@ class Upload < Trailblazer::Activity::FastTrack step :transfer # this might even break! } step :notify - fail :log_error + left :log_error #~meths include T.def_steps(:model, :update, :transfer, :notify, :log_error) #~meths end @@ -63,7 +63,7 @@ class Upload < Trailblazer::Activity::FastTrack Output(:timeout) => Track(:fail_fast) # any wiring is possible here. #:out end step :notify - fail :log_error + left :log_error #~meths include T.def_steps(:model, :update, :transfer, :notify, :log_error) #~meths end @@ -109,7 +109,7 @@ class Upload < Trailblazer::Activity::FastTrack step :transfer # might raise an exception. } step :notify - fail :log_error + left :log_error #~meths include T.def_steps(:model, :update, :transfer, :notify, :log_error) def transfer(ctx, seq:, transfer: true, **) @@ -157,7 +157,7 @@ class Memo::Create < Trailblazer::Operation step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) include Rehash @@ -196,7 +196,7 @@ def self.call((ctx), *, &block) step :rehash }, fail_fast: true step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) @@ -233,7 +233,7 @@ class Memo::Create < Trailblazer::Operation step :rehash }, fast_track: true step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) include Rehash @@ -274,7 +274,7 @@ class Memo::Create < Trailblazer::Operation Output(:success) => End(:transaction_worked), Output(MyTransaction::MyFailSignal, :failure) => End(:transaction_failed) step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) include Rehash @@ -319,7 +319,7 @@ def self.call((ctx), *, &block) step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) @@ -354,7 +354,7 @@ def self.call((ctx), *, &block) step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) @@ -393,7 +393,7 @@ def self.call((ctx), *, &block) step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) @@ -432,7 +432,7 @@ def self.call((ctx), *, &block) step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) @@ -480,7 +480,7 @@ class Memo::Create < Trailblazer::Operation step :rehash } step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) include Rehash @@ -521,7 +521,7 @@ class Memo::Create < Trailblazer::Operation step :update }, fast_track: true # because Wrap can return pass_fast! now step :notify - fail :log_error + left :log_error #~methods include T.def_steps(:model, :update, :notify, :log_error) #~methods end @@ -554,7 +554,7 @@ class Upload < Trailblazer::Activity::FastTrack }, Output(:timeout__) => Track(:fail_fast) step :upload - fail :log_error + left :log_error #~methods include T.def_steps(:model, :send_request, :upload, :log_error) #~methods end