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(); stubAudit(this); stubUserNotification(this); if (options.beforeEach) { options.beforeEach.apply(this, arguments); } this.register = (fullName, Factory) => { let instance = this.application.__deprecatedInstance__; let registry = instance.register ? instance : instance.registry; return registry.register(fullName, Factory); }; }, afterEach() { destroyApp(this.application); if (options.afterEach) { options.afterEach.apply(this, arguments); } } }); }