Sha256: b201194c28f5c66350755abb07f7bc3b3359e3d16afacc09c4be0b0c5785ffcb

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

#
# testing ruote
#
# Mon Aug  3 12:13:11 JST 2009
#

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

require 'ruote/part/hash_participant'


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

  def test_save_to_variable

    pdef = Ruote.process_definition :name => 'test' do
      save :to_variable => 'v'
      alpha
    end

    #noisy

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

    wfid = @engine.launch(pdef)

    wait_for(:alpha)

    ps = @engine.process(wfid)

    assert_equal Hash, ps.variables['v'].class
  end

  def test_save_to_field

    pdef = Ruote.process_definition :name => 'test' do
      set :field => 'nada', :value => 'surf'
      save :to_f => 'f'
      alpha
    end

    #noisy

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

    wfid = @engine.launch(pdef)

    wait_for(:alpha)

    assert_equal 'surf', alpha.first.fields['f']['nada']
  end

  def test_save_to_field_deep

    pdef = Ruote.process_definition :name => 'test' do
      set :field => 'nada', :value => 'surf'
      set :field => 'h', :value => {}
      save :to_f => 'h.wi_as_before'
      alpha
    end

    #noisy

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

    wfid = @engine.launch(pdef)

    wait_for(:alpha)

    #p alpha.first.fields
    assert_equal 'surf', alpha.first.fields['h']['wi_as_before']['nada']
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruote-2.1.11 test/functional/eft_20_save.rb
ruote-2.1.10 test/functional/eft_20_save.rb
ruote-2.1.9 test/functional/eft_20_save.rb
ruote-2.1.8 test/functional/eft_20_save.rb
ruote-2.1.7 test/functional/eft_20_save.rb
ruote-2.1.6 test/functional/eft_20_save.rb
ruote-2.1.5 test/functional/eft_20_save.rb
ruote-2.1.4 test/functional/eft_20_save.rb