test/functional/eft_11_wait.rb in ruote-2.1.11 vs test/functional/eft_11_wait.rb in ruote-2.2.0

- old
+ new

@@ -22,21 +22,26 @@ end end #noisy - ts = [] - @engine.register_participant(:alpha) { ts << Time.now } + @engine.context.stash[:ts] = [] + @engine.register_participant(:alpha) { stash[:ts] << Time.now } + assert_trace 'done.', pdef - #p [ ts[1].sec, ts[0].sec ] - d = (ts[1].sec - ts[0].sec) % 60 + d = ( + @engine.context.stash[:ts][1].sec - @engine.context.stash[:ts][0].sec + ) % 60 + deltas = [ 2, 3 ] + deltas << 4 if @engine.storage.class.name.match(/^Ruote::Couch::/) + assert( - [ 2, 3 ].include?(d), - "delta is #{d}, which isn't 2 or 3") + deltas.include?(d), + "delta is #{d}, which isn't in #{deltas.inspect}") end def test_cancel_wait pdef = Ruote.process_definition do @@ -61,10 +66,14 @@ assert_equal 0, @engine.storage.get_many('schedules').size end def test_wait_until + @engine.context.stash[:ts] = [] + + @engine.register_participant(:alpha) { stash[:ts] << Time.now } + pdef = Ruote.process_definition do sequence do alpha wait :until => (Time.now + 2.0).to_s alpha @@ -72,16 +81,15 @@ end end #noisy - ts = [] - @engine.register_participant(:alpha) { ts << Time.now } - assert_trace 'done.', pdef - #p ts - assert ts[1] - ts[0] > 1.0, "#{ts[1] - ts[0]} should be > 1.0" + ts0 = @engine.context.stash[:ts][0] + ts1 = @engine.context.stash[:ts][1] + + assert(ts1 - ts0 > 1.0, "#{ts1 - ts0} should be > 1.0") end def test_wait_until_now pdef = Ruote.process_definition do