github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/app/tests/helpers/module-for-acceptance.js (about)

     1  import { module } from 'qunit';
     2  import Ember from 'ember';
     3  import startApp from '../helpers/start-app';
     4  import destroyApp from '../helpers/destroy-app';
     5  
     6  const { RSVP: { Promise } } = Ember;
     7  
     8  export default function(name, options = {}) {
     9    module(name, {
    10      beforeEach() {
    11        	this.application = startApp();
    12  		localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
    13  		stubAudit(this);
    14  		stubUserNotification(this);
    15  		server.createList('folder', 2);
    16  		server.createList('user', 2);
    17  		server.createList('document', 2);
    18  		server.createList('permission', 4);
    19  		server.createList('folder-permission', 2);
    20  		server.createList('organization', 1);
    21  
    22        if (options.beforeEach) {
    23          return options.beforeEach.apply(this, arguments);
    24        }
    25      },
    26  
    27      afterEach() {
    28        let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
    29        return Promise.resolve(afterEach).then(() => destroyApp(this.application));
    30      }
    31    });
    32  }