Example #1
0
asyncTest('url and settings arguments', function() {
  var server = fakeServer('GET', '/foo?baz=qux', {foo: 'bar'});
  raw('/foo', {data: {baz: 'qux'}}).then(function(result) {
    start();
    deepEqual(result.response, {foo: 'bar'});
  });
  server.respond();
  server.restore();
});
Example #2
0
asyncTest('settings as only argument', function() {
  var server = fakeServer('GET', '/foo', {foo: 'bar'});
  raw({url: '/foo'}).then(function(result) {
    start();
    deepEqual(result.response, {foo: 'bar'});
  });
  server.respond();
  server.restore();
});
Example #3
0
asyncTest('rejects the promise when the textStatus of the fixture is not success', function() {
  fixtures.define('/post', {
    errorThrown: 'Unprocessable Entity',
    textStatus: 'error',
    jqXHR: {}
  });

  start();
  raw('/post').then(null, function(reason) {
    deepEqual(reason, fixtures.lookup('/post'));
  });
});
Example #4
0
asyncTest('pulls from fixtures', function() {
  fixtures.define('/get', {
    response: { foo: 'bar' },
    textStatus: 'success',
    jqXHR: {}
  });

  raw('/get').then(function(result) {
    start();
    deepEqual(result, fixtures.lookup('/get'));
  });
});
Example #5
0
 throws(function() {
   raw('/foo', { success: k, error: k });
 });
Example #6
0
 throws(function() {
   raw('/foo', { error: k });
 });