Sha256: f68351af77e894e4819fe57a9547a25f7b4ee7f50f918572936e443c96375da6

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

CORS_SERVER = '127.0.0.1.xip.io:9292'

describe 'CORS', ->

  it 'should allow access to dynamic resource', (done) ->
    $.get "http://#{CORS_SERVER}/", (data, status, xhr) ->
      expect(data).to.eql('Hello world')
      done()

  it 'should allow PUT access to dynamic resource', (done) ->
    $.ajax("http://#{CORS_SERVER}/", type: 'PUT').done (data, textStatus, jqXHR) ->
      expect(data).to.eql('Hello world')
      done()

  it 'should allow HEAD access to dynamic resource', (done) ->
    $.ajax("http://#{CORS_SERVER}/", type: 'HEAD').done (data, textStatus, jqXHR) ->
      expect(jqXHR.status).to.eql(200)
      done()

  it 'should allow DELETE access to dynamic resource', (done) ->
    $.ajax("http://#{CORS_SERVER}/", type: 'DELETE').done (data, textStatus, jqXHR) ->
      expect(data).to.eql('Hello world')
      done()

  it 'should allow OPTIONS access to dynamic resource', (done) ->
    $.ajax("http://#{CORS_SERVER}/", type: 'OPTIONS').done (data, textStatus, jqXHR) ->
      expect(jqXHR.status).to.eql(200)
      done()

  it 'should allow access to static resource', (done) ->
    $.get "http://#{CORS_SERVER}/static.txt", (data, status, xhr) ->
      expect($.trim(data)).to.eql("hello world")
      done()

  it 'should allow post resource', (done) ->
    $.ajax
      type: 'POST'
      url: "http://#{CORS_SERVER}/cors"
      beforeSend: (xhr) -> xhr.setRequestHeader('X-Requested-With', 'XMLHTTPRequest')
      success:(data, status, xhr) ->
        expect($.trim(data)).to.eql("OK!")
        done()

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-cors-1.0.2 test/cors/test.cors.coffee
rack-cors-1.0.1 test/cors/test.cors.coffee
rack-cors-1.0.0 test/cors/test.cors.coffee