diff --git a/test/docs/guard_test.rb b/test/docs/guard_test.rb index eec360e..98e6bd0 100644 --- a/test/docs/guard_test.rb +++ b/test/docs/guard_test.rb @@ -108,30 +108,6 @@ class Create < Trailblazer::Operation } end -#--- -# dependency injection -class DocsGuardInjectionTest < Minitest::Spec - #:di-op - class Create < Trailblazer::Operation - extend Trailblazer::Operation::Container - - step Policy::Guard( ->(options, current_user:, **) { current_user == Module } ) - end - #:di-op end - - it { Create.(:current_user => Module).inspect("").must_equal %{} } - it { - result = - #:di-call - Create.( - {}, - :current_user => Module, - :"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false }) - ) - #:di-call end - result.inspect("").must_equal %{} } -end - #--- # missing current_user throws exception class DocsGuardMissingKeywordTest < Minitest::Spec diff --git a/test/docs/rescue_test.rb b/test/docs/rescue_test.rb index 3d4ef4c..1ea8233 100644 --- a/test/docs/rescue_test.rb +++ b/test/docs/rescue_test.rb @@ -126,4 +126,29 @@ def my_handler(exception, (ctx), *) it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{} } it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{} } end + +=begin +Rescue(), fast_track: true {} +=end + class RescueWithFastTrack < Minitest::Spec + Memo = Class.new + + #:rescue-fasttrack + class Memo::Create < Trailblazer::Operation + rescue_block = ->(*) { + step :update, Output(:failure) => End(:fail_fast) + step :rehash + } + + step :find_model + step Rescue(&rescue_block), fail_fast: true + step :notify + fail :log_error + #~methods + include T.def_steps(:find_model, :update, :notify, :log_error, :rehash) + end + + it { Memo::Create.( { seq: [], } ).inspect(:seq).must_equal %{} } + it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{} } + end end diff --git a/trailblazer-macro.gemspec b/trailblazer-macro.gemspec index 29715c5..582045d 100644 --- a/trailblazer-macro.gemspec +++ b/trailblazer-macro.gemspec @@ -25,9 +25,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency "roar" spec.add_development_dependency "trailblazer-developer" - spec.add_dependency "trailblazer-activity", ">= 0.10.0", "< 1.0.0" - spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.2.7", "< 1.0.0" - spec.add_dependency "trailblazer-operation", ">= 0.6.2" # TODO: this dependency will be removed. + spec.add_dependency "trailblazer-activity", ">= 0.11.2", "< 1.0.0" + spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.3.3", "< 1.0.0" + spec.add_dependency "trailblazer-operation", ">= 0.6.5" # TODO: this dependency will be removed. spec.required_ruby_version = ">= 2.2.0" end