Sha256: 3515622277547e345a868e27364ceedef9940516aa5a6ad3b97ca4a2b185815f

Contents?: true

Size: 712 Bytes

Versions: 11

Compression:

Stored size: 712 Bytes

Contents

u = up.util
$ = jQuery

beforeEach ->
  @lastRequest = ->
    jasmine.Ajax.requests.mostRecent() or u.fail('There is no last request')

  @respondWith = (args...) ->
    firstArg = args.shift()
    responseText = undefined
    options = undefined
    if u.isString(firstArg)
      responseText = firstArg
      options = args[0] || {}
    else
      options = firstArg
      responseText = options.responseText || 'response-text'
    request = options.request || @lastRequest()
    request.respondWith
      status: options.status || 200
      contentType: options.contentType || 'text/html'
      responseHeaders: options.responseHeaders
      responseText: responseText
      responseURL: options.responseURL

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-1.0.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-1.0.0 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.62.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.62.0 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.61.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.61.0 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.60.3 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.60.2 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.60.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.60.0 spec_app/spec/javascripts/helpers/last_request.js.coffee