docker_manager/manager-client/tests/helpers/module-for-acceptance.js

25 lines
607 B
JavaScript

import { module } from "qunit";
import startApp from "../helpers/start-app";
import destroyApp from "../helpers/destroy-app";
import { Promise } from "rsvp";
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)
);
}
});
}