2014-07-11 11 views
7

Próbuję przetestować relację modelu w aplikacji ember-cli, ale ciągle mi mówi: Nie znaleziono modelu dla 'rateType'. Wygląda na to, że nie może znaleźć moich modeli.Testowanie modelu danych ember - nie można znaleźć relacji

Pliki

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

Konto model

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

Próbowałem wielbłąd obudowa atrybut needs butit w ogóle tego nie lubi. needs: ['model:rateType', 'model:fuelGroup']

+0

jesteś w stanie rozwiązać ten problem? – Swati

+0

@Swati jeszcze nie, spróbuję ponownie z ember-cli 0.0.40 w przyszłym tygodniu. – jax

Odpowiedz

3

Twój problem dotyczy modelu. Spróbuj dasherizing "rate-type" w relacji belongsTo.

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