Sha256: 13192098d99adb46f00162450d8e51d1e57796378bb80d6d84a7501a3b78bd56

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

#
# testing ruote
#
# Tue Sep 15 19:26:33 JST 2009
#

require File.join(File.dirname(__FILE__), 'base')


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

  PDEF0 = Ruote.process_definition :name => 'test' do
    sequence do
      echo 'a'
      error
      echo 'b'
    end
  end

  def test_error

    #noisy

    wfid = @engine.launch(PDEF0)

    wait_for(wfid)

    ps = @engine.process(wfid)

    assert_equal(
      'a', @tracer.to_s)
    assert_equal(
      1, ps.errors.size)
    assert_equal(
      '#<Ruote::ForcedError: error triggered from process definition>',
      ps.errors.first.message)
  end

  def test_error_replay

    #noisy

    wfid = @engine.launch(PDEF0)

    wait_for(wfid)

    ps = @engine.process(wfid)

    @engine.replay_at_error(ps.errors.first)

    wait_for(wfid)

    assert_nil @engine.process(wfid)
    assert_equal "a\nb", @tracer.to_s
  end

  def test_error_cancel

    wfid = @engine.launch(PDEF0)

    wait_for(wfid)

    ps = @engine.process(wfid)

    sequence = ps.expressions.find { |fe| fe.fei.expid == '0_0' }

    @engine.cancel_expression(sequence.fei)

    wait_for(wfid)

    assert_nil @engine.process(wfid)
    assert_equal 'a', @tracer.to_s
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/functional/eft_26_error.rb
ruote-2.2.0 test/functional/eft_26_error.rb
ruote-2.1.11 test/functional/eft_26_error.rb
ruote-2.1.10 test/functional/eft_26_error.rb
ruote-2.1.9 test/functional/eft_26_error.rb
ruote-2.1.8 test/functional/eft_26_error.rb
ruote-2.1.7 test/functional/eft_26_error.rb
ruote-2.1.6 test/functional/eft_26_error.rb
ruote-2.1.5 test/functional/eft_26_error.rb
ruote-2.1.4 test/functional/eft_26_error.rb
ruote-2.1.3 test/functional/eft_26_error.rb
ruote-2.1.2 test/functional/eft_26_error.rb
ruote-2.1.1 test/functional/eft_26_error.rb