Simple wait_for_* helper method for Capybara tests
# spec/support/capybara_helpers.rb | |
module CapybaraHelpers | |
def wait_for_whizboo | |
start = Time.now | |
while true | |
break if [check for whizboo here, e.g. with page.evaluate_script] | |
if Time.now > start + 5.seconds | |
fail "Whizboo didn't happen." | |
end | |
sleep 0.1 | |
end | |
end | |
end | |
RSpec.configure do |config| | |
config.include CapybaraHelpers, type: :request | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment