Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active November 23, 2016 11:36
Show Gist options
  • Save thiagoa/4d989eb1856e23a324e7804d15e4b15f to your computer and use it in GitHub Desktop.
Save thiagoa/4d989eb1856e23a324e7804d15e4b15f to your computer and use it in GitHub Desktop.
// spec/javascripts/support/createFakeTimelineServer.js
import sinon from 'sinon';
const headers = { 'Content-Type': 'application/json' };
export default function createFakeTimelineServer() {
const server = sinon.fakeServer.create();
server.autoRespond = true;
server.stubGet = function stubGet(url, { status = 200, body }) {
this.respondWith('GET', url, [status, headers, JSON.stringify(body)]);
};
return server;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment