Skip to content

Instantly share code, notes, and snippets.

@joachimhs
Created October 17, 2014 18:15
Show Gist options
  • Save joachimhs/564781aaf4696e69fd7f to your computer and use it in GitHub Desktop.
Save joachimhs/564781aaf4696e69fd7f to your computer and use it in GitHub Desktop.
window.pretender = new Pretender(function(){
// no routes
});
window.pretender.unhandledRequest = function(verb, path, request) {
console.log("window.pretender.unhandledReques");
console.log(verb);
console.log(path);
console.log(request);
};
window.pretender.handledRequest = function(verb, path, request) {
console.log("window.pretender.handledRequest");
console.log(verb);
console.log(path);
console.log(request);
};
App.rootElement = "#ember-testing";
App.setupForTesting();
//register any test helpers for async tests
Ember.Test.registerHelper("mockAjaxGet", function(app, url, responseStatus, responseJson) {
console.log("STUBBING: " + url + " responseStatus: " + responseStatus);// + " JSON: " + responseJson);
window.pretender.get(url, function(request) {
console.log("CALLBACK!: " + request);
return [responseStatus, {"Content-Type": "application/json"}, responseJson];
});
});
App.injectTestHelpers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment