Sha256: 23d149e4742cbf107b55c70ce4a1eb13298ecb98e33014dabdd41c850584304f

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

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

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


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 = @dashboard.launch(PDEF0)

    wait_for(wfid)

    ps = @dashboard.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 = @dashboard.launch(PDEF0)

    wait_for(wfid)

    ps = @dashboard.process(wfid)

    @dashboard.replay_at_error(ps.errors.first)

    wait_for(wfid)

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

  def test_error_cancel

    wfid = @dashboard.launch(PDEF0)

    wait_for(wfid)

    ps = @dashboard.process(wfid)

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

    @dashboard.cancel_expression(sequence.fei)

    wait_for(wfid)

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

Version data entries

4 entries across 4 versions & 1 rubygems

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