stefanpenner/ember-app-kit

Unable to test a route that uses a store

Closed this issue · 3 comments

moduleForModel provides this.store
moduleFor does not.
Thus, if one has a route that has:

model: function() {
   this.store.find("doesn'tMatter");
}

One cannot use moduleFor on it, nor can one use moduleForModel

None of the example tests in EAK or EAK-todo's addresses this, so not sure if it was never intended to work and there some alternate best practice.

My hope is that I can change DS.RESTAdpater etc to point at api-stub or not.. versus having to basically neuter all the tests to 100% unit tests by a truly fake var store;

try adding needs: ['store:main'] to moduleFor

moduleFor('router:name-of-route', {
  needs: ['store:main']
});

@rstudner did the needs injection work for you?

Yeah, sorry fsmanual & steph. I meant to come back and close this one.