2014-07-11 12 views
7

Ich versuche eine Modellbeziehung in einer ember-cli-Anwendung zu testen, aber es sagt mir immer wieder: Kein Modell gefunden für 'rateType'. Es scheint, dass es meine Modelle nicht finden kann.Testen eines Glutendatenmodells - kann keine Beziehung finden

Dateien

~app/models/account.js 
~app/models/rate-type.js 

Konto Modell

export default DS.Model.extend({ 
    ... 
    rateType: DS.belongsTo('rateType'), 
}); 

-Test

import Ember from 'ember'; 
import { test, moduleForModel } from 'ember-qunit'; 
import Account from 'app/models/account'; 
import RateType from 'app/models/rate-type'; 

moduleForModel('account', 'Account Model', { 
    // Specify the other units that are required for this test. 
    needs: ['model:rate-type'] 
}); 

test('rateType relationship', function() { 
    expect(0); 
    this.subject(); //error here 
// var relationships = Ember.get(Account, 'relationships'); 
// deepEqual(relationships.get('rate-type'), [ 
//  { name: 'rateType', kind: 'belongsTo' } 
// ]); 
}); 

Ich habe Kamel Gehäuse versucht das Bedarfsattribut butit mag das gar nicht. needs: ['model:rateType', 'model:fuelGroup']

+0

Sind Sie in der Lage, dieses Problem zu beheben? – Swati

+0

@Swati noch nicht, ich werde es nächste Woche wieder mit ember-cli 0,040 versuchen. – jax

Antwort

3

Ihr Problem ist mit dem Modell. Versuchen Sie, in der Beziehung "ansitesTo" den Typ "rate-type" zu übernehmen.

export default DS.Model.extend({ 
    ... 
    rateType: DS.belongsTo('rate-type') 
});