Sha256: 88ec9d76eff43755c0da8c9165a2fd47853407a18b4fd48804f4eb4e55519317
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
require "test_helper" class TraceTest < Minitest::Spec class B < Trailblazer::Operation step ->(options, **) { options[:b] = true }, id: "B.task.b" step ->(options, **) { options[:e] = true }, id: "B.task.e" end class Create < Trailblazer::Operation step ->(options, a_return:, **) { options[:a] = a_return }, id: "Create.task.a" step({task: B, id: "MyNested"}, B.to_h[:outputs][0] => Track(:success)) step ->(options, **) { options[:c] = true }, id: "Create.task.c" step ->(_options, params:, **) { params.any? }, id: "Create.task.params" end # raise Create["__task_wraps__"].inspect it "allows using low-level Activity::Trace" do ->(*args) { puts "@@@@@ #{args.last.inspect}"; Create.__call__(*args) } stack, = Trailblazer::Developer::Trace.( Create, [ {a_return: true, params: {}}, {} ] ) puts output = Trailblazer::Developer::Trace::Present.(stack) output.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{`-- TraceTest::Create |-- Start.default |-- Create.task.a |-- MyNested | |-- Start.default | |-- B.task.b | |-- B.task.e | `-- End.success |-- Create.task.c |-- Create.task.params `-- End.failure} end it "Operation::trace" do result = Create.trace(params: {x: 1}, a_return: true) result.wtf.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{`-- TraceTest::Create |-- Start.default |-- Create.task.a |-- MyNested | |-- Start.default | |-- B.task.b | |-- B.task.e | `-- End.success |-- Create.task.c |-- Create.task.params `-- End.success} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trailblazer-operation-0.6.0 | test/trace_test.rb |