Sha256: 5a2c9df709864e29ca6dfe2da2cbcfad9fe8241255e17de64bc8303211124162
Contents?: true
Size: 533 Bytes
Versions: 13
Compression:
Stored size: 533 Bytes
Contents
# frozen_string_literal: true module PageMagic # 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(timeout_after: 5, retry_every: 1, &_block) start_time = Time.now until Time.now > start_time + timeout_after return true if yield == true sleep retry_every end raise TimeoutException, 'Action took to long' end end end
Version data entries
13 entries across 13 versions & 1 rubygems