Sha256: 384f90d31cf2a589425beea6ba9599bce1ee81be2fdd684aba2529ba1783ebea

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

#
# testing ruote
#
# Mon Jul 30 17:27:22 JST 2012
#

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


class FtContextTest < Test::Unit::TestCase

  def teardown

    @dashboard.shutdown
    @dashboard.context.storage.purge!
  end

  def test_wait_for_goes_last

    @dashboard = Ruote::Engine.new(Ruote::Worker.new(determine_storage({})))

    log = []

    c = Object.new
    class << c
      attr_accessor :log
      def on_msg(msg)
        log << 'c'
      end
      def wait_for # it's a waiter
        raise 'never called anyway'
      end
    end
    c.log = log

    b = Object.new
    class << b
      attr_accessor :log
      def on_msg(msg)
        log << 'b'
      end
    end
    b.log = log

    a = Object.new
    class << a
      attr_accessor :log
      def on_msg(msg)
        log << 'a'
      end
    end
    a.log = log

    @dashboard.add_service('c', c) # waiter
    @dashboard.add_service('b', b) # observer
    @dashboard.add_service('a', a) # observer

    wfid = @dashboard.launch(Ruote.define do
    end)
    @dashboard.wait_for(wfid)

    assert_equal %w[ a b c a b c ], log
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/functional/ft_75_context.rb
ruote-2.3.0.2 test/functional/ft_75_context.rb
ruote-2.3.0.1 test/functional/ft_75_context.rb
ruote-2.3.0 test/functional/ft_75_context.rb