Retrospring/spec/support/wait_for_ajax.rb

16 lines
320 B
Ruby
Raw Normal View History

2014-11-17 14:25:28 -08:00
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