EDIT:
That error cleared things up. That error doesn't mean that the call to getJSON
should be in an Ember.run
, it means that the callback that getJSON
calls should be in an Ember.run
. It's a quirk of how Ember's run loop works. That code works fine in normal operations, but not in testing mode. There's a brief discussion about it here. What you'll need to do is provide a callback to the getJSON
function. Something like this should fix it (and make it obvious as to what you're doing).
model: function() {
return new Ember.RSVP.Promise(function(resolve) {
Ember.$.getJSON('http://foobar', function(data) {
Ember.run(null, resolve, data);
});
});
}
Or you could use the small library at the bottom of the thread that I linked to. But I figured I'd give you a solution using only Ember.js just in case.