Sha256: 66da7a210284c4979e9559e70711b50549346728ffa4452a8996381bab66b7f5

Contents?: true

Size: 946 Bytes

Versions: 10

Compression:

Stored size: 946 Bytes

Contents

describe 'jQuery'
  describe '.getJSON()'
    it 'should work with mockRequest'
      mockRequest().and_return('{ foo : "bar" }')
      $.getJSON('foo', function(response, statusText){
        response.foo.should.eql 'bar'
        statusText.should.eql 'success'
      })
    end
    
    it 'should work with a json fixture'
      mockRequest().and_return(fixture('test.json'))
      $.getJSON('foo', function(response){
        response.users.tj.email.should.eql 'tj@vision-media.ca'
      })
    end
    
    it 'should not invoke callback when response status is 4xx'
      mockRequest().and_return('foo', 'text/plain', 404)
      $.getJSON('foo', function(){
        fail('callback was invoked')
      })
    end
  end
  
  describe '.post()'
    it 'should work with mockRequest'
      mockRequest().and_return('<p></p>', 'text/html')
      $.post('foo', function(response){
        response.should.eql '<p></p>'
      })
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
mattpuchlerz-jspec-2.11.0 spec/spec.jquery.xhr.js
visionmedia-jspec-2.10.0 spec/spec.jquery.xhr.js
visionmedia-jspec-2.11.0 spec/spec.jquery.xhr.js
visionmedia-jspec-2.11.1 spec/spec.jquery.xhr.js
visionmedia-jspec-2.11.2 spec/spec.jquery.xhr.js
visionmedia-jspec-2.8.2 spec/spec.jquery.xhr.js
visionmedia-jspec-2.8.3 spec/spec.jquery.xhr.js
visionmedia-jspec-2.8.4 spec/spec.jquery.xhr.js
visionmedia-jspec-2.9.0 spec/spec.jquery.xhr.js
visionmedia-jspec-2.9.1 spec/spec.jquery.xhr.js