Hi i'm trying to write first tests in Ember CLI. This is what my test looks like
> ...
>
> moduleForModel('recipe/recipe', 'Recipe Model works', {
> needs: ['model:recipe/recipe'] });
> test('Recipe is a valid ember-data Model', function (assert) {
> var store = this.store();
> var recipe = this.subject({name: 'A title for a recipe'});
>
> assert.ok(recipe instanceof DS.Model); });
And the model recipe/recipe model
...
var Recipe = DS.Model.extend({
name: DS.attr('string'),
category: DS.belongsTo('recipe/category', {async: true}),
file: DS.belongsTo('filerepository/file', {async: true})
});
Recipe.reopenClass({
FIXTURES: [
{ id: 1, name: 'New Recipe'},
]
});
If i run given test, it outputs : Error: No model was found for 'recipe/category'
If i comment //category and //file on model. The test passes. Currently using fixture adapter. When I create records or load them inside app's workflow all the relations work fine. (like store.find('recipe/category') etc..)
You need to declare more models you depend on in moduleForModel
:
needs: ['model:recipe/recipe', 'model:recipe/category', 'model:filerepository/file']