Sha256: cbb67c6f40734ccd494090dee645995615ce82b9311e6ba7966c29e9fbce1293

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

module Archangel
  module TestingSupport
    ##
    # Ajax helpers for feature testing
    #
    module AjaxHelpers
      def wait_for_ajax(timeout = Capybara.default_max_wait_time)
        Timeout.timeout(timeout) do
          loop until finished_all_ajax_requests?
        end
      end

      protected

      def finished_all_ajax_requests?
        page.evaluate_script("jQuery.active").zero?
      end
    end
  end
end

RSpec.configure do |config|
  config.include Archangel::TestingSupport::AjaxHelpers, type: :feature,
                                                         js: true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/support/helpers/ajax_helpers.rb