Skip to content

Commit

Permalink
[BUGFIX] Don't use destroyApp if new API is being used
Browse files Browse the repository at this point in the history
  • Loading branch information
Serabe committed Feb 19, 2018
1 parent f6345b0 commit 606771f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blueprints/acceptance-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = useTestFrameworkDetector({
return {
testFolderRoot: testFolderRoot,
friendlyTestName,
destroyAppExists: destroyAppExists
destroyAppExists
};
}
});
5 changes: 4 additions & 1 deletion blueprints/initializer-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

const path = require('path');
const stringUtils = require('ember-cli-string-utils');
const existsSync = require('exists-sync');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -9,7 +11,8 @@ module.exports = useTestFrameworkDetector({
locals: function(options) {
return {
friendlyTestName: ['Unit', 'Initializer', options.entity.name].join(' | '),
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix)
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix),
destroyAppExists: existsSync(path.join(this.project.root, '/tests/helpers/destroy-app.js'))
};
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { run } from '@ember/runloop';

import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';
<% if (destroyAppExists) { %>import destroyApp from '../../helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop'; <% } %>

module('<%= friendlyTestName %>', {
beforeEach() {
Expand All @@ -13,7 +13,7 @@ module('<%= friendlyTestName %>', {
});
},
afterEach() {
destroyApp(this.application);
<% if (destroyAppExists) { %>destroyApp(this.application);<% } else { %>run(this.application, 'destroy');<% } %>
}
});

Expand Down

0 comments on commit 606771f

Please sign in to comment.