2014-07-11 10 views
7

Sto provando a testare una relazione di modello in un'applicazione ember-cli ma continua a dirmi: Non è stato trovato alcun modello per 'rateType'. Sembra che non riesca a trovare i miei modelli.Test di un modello di dati di brace - impossibile trovare la relazione

file

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

account Modello

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

prova

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' } 
// ]); 
}); 

ho provato involucro cammello l'attributo dei bisogni, ma a lui non piace affatto. needs: ['model:rateType', 'model:fuelGroup']

+0

siete in grado di risolvere questo problema? – Swati

+0

@Swati non ancora, ci riproverò con ember-cli 0.0.40 la prossima settimana. – jax

risposta

3

Il problema è con il modello. Prova a dasherizzare 'rate-type' nella relazione belongsTo.

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