Module: RuoteKit::Spec::RuoteHelpers

Defined in:
lib/ruote-kit/spec/ruote_helpers.rb

Instance Method Summary collapse

Instance Method Details

#find_workitem(wfid, expid) ⇒ Object



37
38
39
# File 'lib/ruote-kit/spec/ruote_helpers.rb', line 37

def find_workitem( wfid, expid )
  storage_participant.by_wfid( wfid ).detect { |wi| wi.fei.expid == expid }
end

#launch_test_process(&block) ⇒ Object

Launch a dummy process and return the wfid



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ruote-kit/spec/ruote_helpers.rb', line 6

def launch_test_process( &block )
  pdef = if block_given?
    yield
  else
    Ruote.process_definition :name => 'test' do
      sequence do
        nada
      end
    end
  end

  wfid = RuoteKit.engine.launch( pdef )

  # Wait for the process list to populate
  sleep 0.1 while RuoteKit.engine.process( wfid ).nil?

  # Give the process some time to traverse the expression tree
  sleep 0.4
  #wait_for( 1 )

  wfid
end

#noisy(on = true) ⇒ Object



29
30
31
# File 'lib/ruote-kit/spec/ruote_helpers.rb', line 29

def noisy( on = true )
  RuoteKit.engine.context[:noisy] = on
end

#storage_participantObject



33
34
35
# File 'lib/ruote-kit/spec/ruote_helpers.rb', line 33

def storage_participant
  RuoteKit.storage_participant
end

#wait_for(wfid) ⇒ Object



41
42
43
# File 'lib/ruote-kit/spec/ruote_helpers.rb', line 41

def wait_for( wfid )
  @_spec_worker.context.logger.wait_for( wfid )
end