Sha256: bb699118e6dbc556874b5a2ee5e67f24c32909a4d1d9c42fc7c5e07f1aa97aae

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

#
# testing ruote
#
# Mon Sep 14 19:31:37 JST 2009
#

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

require 'ruote/participant'
require 'ruote/part/template'


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

  class MyParticipant
    include Ruote::LocalParticipant
    include Ruote::TemplateMixin

    def initialize(opts)

      @template = opts['template']
    end

    def consume(workitem)

      @context['s_tracer'] << render_template(
        @template,
        Ruote::Exp::FlowExpression.fetch(@context, workitem.fei.to_h),
        workitem)
      @context['s_tracer'] << "\n"

      reply_to_engine(workitem)
    end

    def cancel(fei, flavour)
    end
  end

  def test_template

    pdef = Ruote.process_definition :name => 'def0' do
      set 'v:var0' => 'v_value'
      set 'f:field0' => 'f_value'
      alpha
      echo 'done.'
    end

    #noisy

    @engine.register_participant(
      :alpha,
      MyParticipant,
      :template => "0:${v:var0}\n1:${f:field0}")

    assert_trace %w[ 0:v_value 1:f_value done. ], pdef
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/functional/ft_29_part_template.rb
ruote-2.2.0 test/functional/ft_29_part_template.rb