Sha256: 33b0ee6865d5440c77f5c59a09c4abf42c86dda406cb9bf9c0d353bd56d89037
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# =require modules TIMEOUT = 500 # ms - Used to be 300, but FF was too slow extendClass 'specs.jasmine.AjaxHelpers', (self)-> ajaxServer = null initialize: (fakeAjaxServer, options={})-> ajaxServer = fakeAjaxServer TIMEOUT = options.timeout if options.timeout ajaxSettings: -> ajaxServer.ajaxSettings() waitsFor: (condition, message="waited event didn't happen", timeout=TIMEOUT)-> waitsFor (-> condition.call self), message, timeout waitsForAjaxRequest: (message = "An AJAX call was expected", timeout=TIMEOUT, extraCondition)-> @waitsFor (-> ajaxServer.ajaxCallbacksQueue.length and (not extraCondition or extraCondition.call self)), message, timeout waitsForAjaxRequestAnd: (condition, message, timeout)-> @waitsForAjaxRequest(message, timeout, condition) nextRequest: (url, method, format)-> @checkRequestSettings(url, method, format) ajaxServer.processNextRequest() checkRequestSettings: (url, method, format)-> s = @ajaxSettings() expect(s.url).toBe url unless url is undefined expect(s.type).toBe method unless method is undefined expect(s.dataType).toBe format unless format is undefined ignoreRequest: (url, method, format)-> @checkRequestSettings(url, method, format) ajaxServer.ignoreNextRequest() ignoreAllRequest: -> ajaxServer.ignoreAllRequest()
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oojs-0.0.4 | lib/assets/javascripts/jasmine_helpers/ajax_spec_helpers.js.coffee |