Monday, November 16, 2015

Wait for External calls to finish

Note to myself: Create an utility similar to this : https://robots.thoughtbot.com/automatically-wait-for-ajax-with-capybara to fix the sleep hack in Stripe project.

# spec/support/wait_for_external_call.rb
module WaitForExternalCall
  def wait_for_remote_call
    Timeout.timeout(Capybara.default_wait_time) do
      loop until custom_assertion_passed?
    end
  end

  def custom_assertion_passed?
   
  end
end

RSpec.configure do |config|
  config.include WaitForExternalCall, type: :feature
end