Sha256: cc0de1fefac555bffc8c7395f2fd1eb9a73a5c69bf31f013892cb5214c83910c

Contents?: true

Size: 371 Bytes

Versions: 1

Compression:

Stored size: 371 Bytes

Contents

class RailsExtras
  module RSpec
    module Support
      module WaitForAjax

        def wait_for_ajax
          counter = 0
          while page.execute_script("return $.active").to_i > 0
            counter += 1
            sleep(0.1)
            raise "AJAX request took longer than 3 seconds." if counter >= 30
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_extras-0.1.4 lib/rails_extras/rspec/support/wait_for_ajax.rb