Initial Commit from Ember CLI v2.5.0

This commit is contained in:
Tomster
2016-04-25 13:15:27 +03:00
commit 53d15517f7
37 changed files with 536 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}

View 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
View 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;

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