Sha256: 2630830ae670517b6df0a71ff57d07595525e8232b8fb071fd2177248198ce79

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

#
# Testing Ruote (OpenWFEru)
#
# Sun Jun 14 14:48:03 JST 2009
#

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

require 'ruote/part/hash_participant'


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

  def test_undo_ref

    pdef = Ruote.process_definition do
      concurrence do
        alpha :tag => 'kilroy'
        undo :ref => 'kilroy'
      end
      echo 'over'
    end

    alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new

    #noisy

    assert_trace pdef, %w[ over ]

    assert_equal 0, alpha.size

    assert_equal 1, logger.log.select { |e| e['action'] == 'entered_tag' }.size
    assert_equal 1, logger.log.select { |e| e['action'] == 'cancel' }.size
    assert_equal 1, logger.log.select { |e| e['action'] == 'left_tag' }.size
  end

  def test_undo

    pdef = Ruote.process_definition do
      concurrence do
        alpha :tag => :kilroy
        #undo :kilroy
        cancel :kilroy
      end
      echo 'over'
    end

    alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new

    #noisy

    assert_trace pdef, %w[ over ]

    assert_equal 0, alpha.size

    assert_equal 1, logger.log.select { |e| e['action'] == 'entered_tag' }.size
    assert_equal 1, logger.log.select { |e| e['action'] == 'cancel' }.size
    assert_equal 1, logger.log.select { |e| e['action'] == 'left_tag' }.size
  end

  def test_undo_parent

    pdef = Ruote.process_definition do
      sequence :tag => :richard do
        cancel :richard
        echo 'out'
      end
      echo '.'
    end

    #noisy

    assert_trace pdef, '.'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruote-2.1.3 test/functional/eft_8_undo.rb
ruote-2.1.2 test/functional/eft_8_undo.rb
ruote-2.1.1 test/functional/eft_8_undo.rb