Module: Capybara::Widgets::AsyncHelper
Instance Method Summary collapse
Instance Method Details
#eventually(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/capybara/widgets/helpers/async_helper.rb', line 4 def eventually( = {}) timeout = [:timeout] || Capybara.default_max_wait_time interval = [:interval] || 0.1 time_limit = Time.now + timeout loop do begin result = yield rescue => error end return result if error.nil? raise error if Time.now >= time_limit sleep interval end end |