Sha256: ab108cc28e85f7b3ec725e6b230118c050b92907ba9907d3270156def18eaafc
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require "test_helper" class Ruby200PipetreeTest < Minitest::Spec class Create < Trailblazer::Operation step ->(*, params:, **) { params["run"] } # only test kws. step ->(options, params:nil, **) { options["x"] = params["run"] } # read and write. step ->(options) { options["y"] = options["params"]["run"] } # old API. end it { Create.("run" => false).inspect("x", "y").must_equal %{<Result:false [nil, nil] >} } it { Create.("run" => true).inspect("x", "y").must_equal %{<Result:true [true, true] >} } #- instance methods class Update < Trailblazer::Operation step :params! # only test kws. step :x! # read and write. step :y! # old API. def params!(*, params:, **) params["run"] end def x!(options, params:nil, **) options["x"] = params["run"] end def y!(options) options["y"] = options["params"]["run"] end end it { Update.("run" => false).inspect("x", "y").must_equal %{<Result:false [nil, nil] >} } it { Update.("run" => true).inspect("x", "y").must_equal %{<Result:true [true, true] >} } class Delete < Trailblazer::Operation class Params extend Uber::Callable def self.call(*, params:, **) params["run"] end end class X extend Uber::Callable def self.call(options, params:nil, **) options["x"] = params["run"] end end class Y extend Uber::Callable def self.call(options) options["y"] = options["params"]["run"] end end step Params step X step Y end it { Delete.("run" => false).inspect("x", "y").must_equal %{<Result:false [nil, nil] >} } it { Delete.("run" => true).inspect("x", "y").must_equal %{<Result:true [true, true] >} } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trailblazer-operation-0.0.9 | test/2.0.0-pipetree_test.rb |