mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:29:53 +01:00
15 lines
320 B
Ruby
15 lines
320 B
Ruby
module WaitForAjax
|
|
def wait_for_ajax
|
|
Timeout.timeout(Capybara.default_wait_time) do
|
|
loop until finished_all_ajax_requests?
|
|
end
|
|
end
|
|
|
|
def finished_all_ajax_requests?
|
|
page.evaluate_script('jQuery.active').zero?
|
|
end
|
|
end
|
|
|
|
RSpec.configure do |config|
|
|
config.include WaitForAjax, type: :feature
|
|
end
|