Initial Commit from Ember CLI v2.5.0
This commit is contained in:
5
tests/helpers/destroy-app.js
Normal file
5
tests/helpers/destroy-app.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default function destroyApp(application) {
|
||||
Ember.run(application, 'destroy');
|
||||
}
|
||||
23
tests/helpers/module-for-acceptance.js
Normal file
23
tests/helpers/module-for-acceptance.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { module } from 'qunit';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
export default function(name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
this.application = startApp();
|
||||
|
||||
if (options.beforeEach) {
|
||||
options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
if (options.afterEach) {
|
||||
options.afterEach.apply(this, arguments);
|
||||
}
|
||||
|
||||
destroyApp(this.application);
|
||||
}
|
||||
});
|
||||
}
|
||||
11
tests/helpers/resolver.js
Normal file
11
tests/helpers/resolver.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Resolver from '../../resolver';
|
||||
import config from '../../config/environment';
|
||||
|
||||
const resolver = Resolver.create();
|
||||
|
||||
resolver.namespace = {
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix
|
||||
};
|
||||
|
||||
export default resolver;
|
||||
18
tests/helpers/start-app.js
Normal file
18
tests/helpers/start-app.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import Ember from 'ember';
|
||||
import Application from '../../app';
|
||||
import config from '../../config/environment';
|
||||
|
||||
export default function startApp(attrs) {
|
||||
let application;
|
||||
|
||||
let attributes = Ember.merge({}, config.APP);
|
||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||
|
||||
Ember.run(() => {
|
||||
application = Application.create(attributes);
|
||||
application.setupForTesting();
|
||||
application.injectTestHelpers();
|
||||
});
|
||||
|
||||
return application;
|
||||
}
|
||||
Reference in New Issue
Block a user