cms/app-client/tests/helpers/module-for-acceptance.js
author ymh <ymh.work@gmail.com>
Thu, 23 Feb 2017 10:37:22 +0100
changeset 522 c6cad1055714
parent 155 76ae75975ee2
child 543 aaaf9b0b09f6
permissions -rw-r--r--
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933

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