server/bo_client/tests/helpers/module-for-acceptance.js
author Chloe Laisne <chloe.laisne@gmail.com>
Wed, 24 Aug 2016 17:22:02 +0200
changeset 265 5995d360e6ac
parent 155 76ae75975ee2
child 543 aaaf9b0b09f6
permissions -rw-r--r--
Discourse bubbles radius range + font size

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));
    }
  });
}