Sha256: 992dee203db08f99d37822703fe198ade366f375f607045433a7c73fdb4106f0

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 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 plus pole (happens with Nested)" do
    class Present < Trailblazer::Operation
      pass :ok!, plus_poles: Trailblazer::Activity::Magnetic::DSL::PlusPoles::from_outputs( :success => Trailblazer::Activity.Output("signal", :success) )
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trailblazer-operation-0.2.2 test/inspect_test.rb
trailblazer-operation-0.2.1 test/inspect_test.rb
trailblazer-operation-0.2.0 test/inspect_test.rb
trailblazer-operation-0.1.3 test/inspect_test.rb
trailblazer-operation-0.1.2 test/inspect_test.rb
trailblazer-operation-0.1.1 test/inspect_test.rb