ember-cli-101-errata icon indicating copy to clipboard operation
ember-cli-101-errata copied to clipboard

Page 120: Typo and different file contents

Open kgish opened this issue 11 years ago • 4 comments

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);
});

kgish avatar Nov 30 '14 18:11 kgish

Thanks! file name was incorrect, about the content is the same but different formatting, the blueprint was changed.

abuiles avatar Dec 07 '14 21:12 abuiles

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?

kgish avatar Dec 11 '14 18:12 kgish

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?

fvieira avatar Feb 09 '15 20:02 fvieira

Thanks @fvieira for that tip. Saved me figuring it out myself.

pablobm avatar Jul 01 '15 11:07 pablobm