Super basic test support for listing topics

This commit is contained in:
Robin Ward
2013-06-13 15:08:42 -04:00
parent cb6774a895
commit 5193ddc72f
10 changed files with 88 additions and 24 deletions

View File

@ -225,6 +225,7 @@ Discourse = Ember.Application.createWithMixins({
ajax: function() {
var url, args;
if (arguments.length === 1) {
if (typeof arguments[0] === "string") {
url = arguments[0];
@ -246,6 +247,14 @@ Discourse = Ember.Application.createWithMixins({
console.warning("DEPRECATION: Discourse.ajax should use promises, received 'error' callback");
}
// If we have URL_FIXTURES, load from there instead (testing)
var fixture = Discourse.URL_FIXTURES && Discourse.URL_FIXTURES[url];
if (fixture) {
return Ember.Deferred.promise(function(promise) {
promise.resolve(fixture);
})
}
return Ember.Deferred.promise(function (promise) {
var oldSuccess = args.success;
args.success = function(xhr) {