mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
Add ember to project
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');
|
||||
}
|
||||
24
tests/helpers/module-for-acceptance.js
Normal file
24
tests/helpers/module-for-acceptance.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import {module} from 'qunit';
|
||||
import Ember from 'ember';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
const {RSVP: {Promise}} = Ember;
|
||||
|
||||
export default function (name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
this.application = startApp();
|
||||
|
||||
if (options.beforeEach) {
|
||||
return options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
|
||||
return Promise.resolve(afterEach).then(() = > 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;
|
||||
17
tests/helpers/start-app.js
Normal file
17
tests/helpers/start-app.js
Normal file
@@ -0,0 +1,17 @@
|
||||
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