Sha256: c7ce863468a95d46e9baa31e74647b4bb89cad62caa44a45daaa845af125dcc3

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

#
# testing ruote
#
# Mon Jun 27 11:24:21 JST 2011
#


require File.expand_path('../base', __FILE__)


class EftFlowExpressionTest < Test::Unit::TestCase
  include FunctionalBase

  def test_root_and_root_id

    @dashboard.register :alpha, Ruote::NullParticipant

    wfid = @dashboard.launch(Ruote.define do
      sequence do
        alpha
      end
    end)

    @dashboard.wait_for(:alpha)

    fexp = @dashboard.ps(wfid).expressions.last

    assert_equal '0', fexp.root.fei.expid
    assert_equal Ruote::Exp::SequenceExpression, fexp.root.class

    assert_equal '0', fexp.root_id.expid
  end

  class MyParticipant < Ruote::Participant
    def on_workitem
      workitem.fields['roots'] = [
        fexp.root.class.to_s, fexp.root(true).class.to_s
      ]
      reply
    end
  end

  def test_root_stubborn

    @dashboard.register :toto, MyParticipant

    pdef = Ruote.define do
      concurrence :remaining => 'forget', :wait_for => 1 do
        sequence do
          # exit immediately
        end
        sequence do
          wait '1s'
          toto
        end
      end
    end

    wfid = @dashboard.launch(pdef)

    @dashboard.wait_for('terminated')
    r = @dashboard.wait_for('ceased')

    assert_equal(
      %w[ Ruote::Exp::ConcurrenceExpression NilClass ],
      r['workitem']['fields']['roots'])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/functional/eft_0_flow_expression.rb
ruote-2.3.0.2 test/functional/eft_0_flow_expression.rb
ruote-2.3.0.1 test/functional/eft_0_flow_expression.rb