Sha256: 7662ae3920d3045fdd320f67bdf13188c755c9b274a0bbc80b7e3a6e56f7aab3

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

require "test_helper"


class InspectTest < Minitest::Spec
  # Test: #to_table
  class Create < Trailblazer::Operation
    step :decide!
    pass :wasnt_ok!
    pass :was_ok!
    fail :return_true!
    fail :return_false!
    step :finalize!
  end

  #---
  #- to_table

  # pp Create.instance_variable_get(:@builder)

  it do
    Trailblazer::Operation.introspect(Create).must_equal %{[>decide!,>>wasnt_ok!,>>was_ok!,<<return_true!,<<return_false!,>finalize!]}
  end

  it do
    Trailblazer::Operation::Inspect.call(Create, style: :rows).must_equal %{
 0 ==============================>decide!
 1 ===========================>>wasnt_ok!
 2 =============================>>was_ok!
 3 <<return_true!========================
 4 <<return_false!=======================
 5 ============================>finalize!}
  end

  describe "step with only one output (happens with Nested)" do
    class Present < Trailblazer::Operation
      pass :ok!, outputs: {:success => Trailblazer::Activity::Output("signal", :success)}
    end

    it do
      Trailblazer::Operation.introspect(Present).must_equal %{[>>ok!]}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trailblazer-operation-0.4.1 test/inspect_test.rb
trailblazer-operation-0.4.0 test/inspect_test.rb
trailblazer-operation-0.3.1 test/inspect_test.rb
trailblazer-operation-0.3.0 test/inspect_test.rb
trailblazer-operation-0.2.5 test/inspect_test.rb
trailblazer-operation-0.2.4 test/inspect_test.rb
trailblazer-operation-0.2.3 test/inspect_test.rb