Sha256: 7705cadd676e8d48bb2aeb9e58de8772a3a7bab636e0ced768e70ccae23e1d37

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

u = up.util

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unpoly-rails-0.51.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.51.0 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.50.2 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.50.1 spec_app/spec/javascripts/helpers/last_request.js.coffee
unpoly-rails-0.50.0 spec_app/spec/javascripts/helpers/last_request.js.coffee