test/docs/guard_test.rb in trailblazer-macro-2.1.0.rc1 vs test/docs/guard_test.rb in trailblazer-macro-2.1.0.rc11
- old
+ new
@@ -108,18 +108,21 @@
#---
# 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 %{<Result:true [nil] >} }
it {
result =
#:di-call
- Create.({},
+ Create.(
+ {},
:current_user => Module,
"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false })
)
#:di-call end
result.inspect("").must_equal %{<Result:false [nil] >} }