adopted-ember-addons / ember-data-factory-guy

Factories and helper functions for (unit, integration, acceptance) testing + development scenarios with Ember Data
MIT License
301 stars 136 forks source link

Application's store unavailable message wrong for latest ember-cli-qunit #326

Closed Charizard closed 6 years ago

Charizard commented 6 years ago

With the new emberjs/rfcs#232 RFC, the error message when Factory Guy can't access the application instance is wrong.

This

Assertion Failed: [ember-data-factory-guy] FactoryGuy does not have the application's store.
       Use manualSetup(this.container) in model/component test
       before using make/makeList

should change to

Assertion Failed: [ember-data-factory-guy] FactoryGuy does not have the application's store.
       Use manualSetup(this.owner) in model/component test
       before using make/makeList
danielspaniel commented 6 years ago

Your 100% right, I have changed all my tests, but forgot to change the error message .. gimme a moment to fix that

Charizard commented 6 years ago

*You are 😆

Thanks for the awesome addon though.

danielspaniel commented 6 years ago

This is now fixed in v2.13.24

I made it so you can not screw it up anymore since now .. you only have to do

manualSetup(this);

and it will so the right thing

Thanks for pointing out he message being wrong :)

Turbo87 commented 6 years ago

FWIW I would recommend exporting a setupFactoryGuy() function for the new testing APIs like this:

export function setupFactoryGuy(hooks) {
  hooks.beforeEach(function() {
    manualSetup(this.owner);
  });
}
danielspaniel commented 6 years ago

good suggestion .. stay tuned for that one

danielspaniel commented 6 years ago

v2.13.26 now has setupFactoryGuy(hooks) method @Turbo87

Turbo87 commented 6 years ago

awesome, thanks! seem like I can remove our custom one then 😉