Module: Mirage::WaitMethods
- Included in:
- Runner
- Defined in:
- lib/mirage/wait_methods.rb
Overview
module WaitMethods - contains methods for waiting
Instance Method Summary collapse
-
#wait_until(opts = {}) ⇒ Object
Wait until a the supplied block returns true.
Instance Method Details
#wait_until(opts = {}) ⇒ Object
Wait until a the supplied block returns true
14 15 16 17 18 19 20 21 22 |
# File 'lib/mirage/wait_methods.rb', line 14 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 |