jeudi 4 août 2016

Ember use getOwner to access config in acceptance tests

While in integration tests I can use:

import getOwner from 'ember-owner/get';

and then

moduleForComponent('mycomponent', 'Integration | Component | mycomponent', {
    integration: true,
    beforeEach() {
        const config = getOwner(this).resolveRegistration('config:environment');

In acceptance test getOwner(this) is undefined and the only option I have to do this without getOwner is:

moduleForAcceptance('Acceptance | cool test', {
    beforeEach() {
        const config = this.application.__container__.lookupFactory('config:environment');

Any suggestions?




Aucun commentaire:

Enregistrer un commentaire