Sha256: b384b5cdda1f48582c4211b47bbf89dec705bb90b1b22f9e16d602abe2e64764
Contents?: true
Size: 828 Bytes
Versions: 14
Compression:
Stored size: 828 Bytes
Contents
require "test_helper" class DocsMacroTest < Minitest::Spec #:simple module Macro def self.MyPolicy(allowed_role: "admin") step = ->(input, options) { options["current_user"].type == allowed_role } {task: step, id: "my_policy.#{allowed_role}"} # :before, :replace, etc. work, too. end end #:simple end #:simple-op class Create < Trailblazer::Operation step Macro::MyPolicy( allowed_role: "manager" ) # .. end #:simple-op end =begin it do #:simple-pipe puts Create["pipetree"].inspect(style: :rows) #=> 0 ========================>operation.new 1 ====================>my_policy.manager #:simple-pipe end end =end it { Trailblazer::Developer.railway(Create).must_equal %{[>my_policy.manager]} } end # injectable option # nested pipe # using macros in macros
Version data entries
14 entries across 14 versions & 1 rubygems