ember-cli-101-errata
ember-cli-101-errata copied to clipboard
Page 120: Typo and different file contents
On page 120,
tests/unit/model/friend-tests.js should be tests/unit/models/friend-tests.js (models with an 's')
Also, my contents look differently from this in the book, namely:
import {
moduleForModel,
test
} from 'ember-qunit';
moduleForModel('friend', 'Friend', {
// Specify the other units that are required for this test.
needs: []
});
test('it exists', function() {
var model = this.subject();
// var store = this.store();
ok(!!model);
});
Thanks! file name was incorrect, about the content is the same but different formatting, the blueprint was changed.
Well, not quite. My version contains this:
needs: []
while yours looks like this:
needs: ['model:article']
No where else in your book do you mention adding this, or did I miss something?
I just spent a non-trivial amount of time trying to fix a broken test, and finally found that what I needed was to add this 'model:article' to the needs list in friends-test.js.
I think I followed the instructions in the book pretty much to the letter and this wasn't added automatically anywhere. Maybe the book should be explicit about this being needed right after the articles field is added to the friends model so that we can run the tests while coding the project.
Can you reopen this issue?
Thanks @fvieira for that tip. Saved me figuring it out myself.