Sha256: bed9f4ec19f117b8d071ce492146ee58730a780be95b47822d285df82695f719

Contents?: true

Size: 368 Bytes

Versions: 6

Compression:

Stored size: 368 Bytes

Contents

module Specs
  def self.sleep_and_wait_until(timeout = 10)
    t1 = Time.now.to_f
    ::Timeout.timeout(timeout) do
      loop until yield
    end

    diff = Time.now.to_f - t1
    STDERR.puts "wait took a bit long: #{diff} seconds" if diff > Specs::TIMER_QUANTUM
  rescue Timeout::Error
    t2 = Time.now.to_f
    raise "Timeout after: #{t2 - t1} seconds"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
celluloid-0.18.0 spec/support/sleep_and_wait.rb
celluloid-0.17.4 spec/support/sleep_and_wait.rb
celluloid-0.18.0.pre2 spec/support/sleep_and_wait.rb
celluloid-0.18.0.pre spec/support/sleep_and_wait.rb
celluloid-0.17.3 spec/support/sleep_and_wait.rb
celluloid-0.17.2 spec/support/sleep_and_wait.rb