Sha256: fce4f9e3cb1b79f1e9bd05ea32b0fb0c76732e17cd6ac9e1be9ff8667a490663

Contents?: true

Size: 1003 Bytes

Versions: 4

Compression:

Stored size: 1003 Bytes

Contents

#
# testing ruote
#
# Wed Jun 29 12:05:41 JST 2011
#

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

require 'ruote/workitem'
require 'ruote/part/local_participant'


class UtParticipantsTest < Test::Unit::TestCase

  class OldParticipant
    include Ruote::LocalParticipant
    def consume(workitem)
      $result = workitem.fields['test']
    end
  end

  class NewParticipant
    include Ruote::LocalParticipant
    def on_workitem
      $result = workitem.fields['test']
    end
  end

  def new_workitem(fields)
    Ruote::Workitem.new('fields' => fields)
  end

  def test_consume

    OldParticipant.new._consume(new_workitem('test' => 'zero'))
    assert_equal 'zero', $result
    OldParticipant.new._on_workitem(new_workitem('test' => 'zero'))
    assert_equal 'zero', $result

    NewParticipant.new._consume(new_workitem('test' => 'one'))
    assert_equal 'one', $result
    NewParticipant.new._on_workitem(new_workitem('test' => 'one'))
    assert_equal 'one', $result
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/unit/ut_10_participants.rb
ruote-2.3.0.2 test/unit/ut_10_participants.rb
ruote-2.3.0.1 test/unit/ut_10_participants.rb
ruote-2.3.0 test/unit/ut_10_participants.rb