こんにちは、Ember CLI で最初のテストを作成しようとしています。これは私のテストがどのように見えるかです
> ...
>
> 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); });
そしてモデルレシピ/レシピモデル
...
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'},
]
});
特定のテストを実行すると、次のように出力されます:エラー: 「レシピ/カテゴリ」のモデルが見つかりませんでした
//category と //file をモデルにコメントすると。テストに合格します。現在フィクスチャーアダプターを使用しています。レコードを作成するか、アプリのワークフロー内にロードすると、すべての関係が正常に機能します。(store.find('recipe/category') など)