Sha256: dee37c9d56f50534c944d79f00100571fd07edbdf9c2b8d031aef5629b5377eb
Contents?: true
Size: 587 Bytes
Versions: 13
Compression:
Stored size: 587 Bytes
Contents
module Mirage class TimeoutException < Exception end # module WaitMethods - contains methods for waiting module WaitMethods # Wait until a the supplied block returns true # @example # wait_until do # (rand % 2) == 0 # end def wait_until(opts = {}) opts = {timeout_after: 5, retry_every: 0.1}.merge(opts) start_time = Time.now until Time.now > start_time + opts[:timeout_after] return true if yield == true sleep opts[:retry_every] end fail TimeoutException, 'Action took to long' end end end
Version data entries
13 entries across 13 versions & 1 rubygems