2016-07-07 18:54:16 -07:00
|
|
|
import { module } from 'qunit';
|
2016-10-04 15:24:21 -07:00
|
|
|
import Ember from 'ember';
|
2016-07-07 18:54:16 -07:00
|
|
|
import startApp from '../helpers/start-app';
|
|
|
|
import destroyApp from '../helpers/destroy-app';
|
|
|
|
|
2016-10-04 15:24:21 -07:00
|
|
|
const { RSVP: { Promise } } = Ember;
|
2016-07-07 18:54:16 -07:00
|
|
|
|
2016-10-04 15:24:21 -07:00
|
|
|
export default function(name, options = {}) {
|
|
|
|
module(name, {
|
|
|
|
beforeEach() {
|
|
|
|
this.application = startApp();
|
|
|
|
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
|
|
|
|
stubAudit(this);
|
|
|
|
stubUserNotification(this);
|
|
|
|
server.createList('folder', 2);
|
|
|
|
server.createList('user', 2);
|
|
|
|
server.createList('document', 2);
|
|
|
|
server.createList('permission', 4);
|
|
|
|
server.createList('folder-permission', 2);
|
|
|
|
server.createList('organization', 1);
|
2016-07-07 18:54:16 -07:00
|
|
|
|
2016-10-04 15:24:21 -07:00
|
|
|
if (options.beforeEach) {
|
|
|
|
return options.beforeEach.apply(this, arguments);
|
|
|
|
}
|
|
|
|
},
|
2016-07-07 18:54:16 -07:00
|
|
|
|
2016-10-04 15:24:21 -07:00
|
|
|
afterEach() {
|
|
|
|
let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
|
|
|
|
return Promise.resolve(afterEach).then(() => destroyApp(this.application));
|
|
|
|
}
|
|
|
|
});
|
2016-07-07 18:54:16 -07:00
|
|
|
}
|