common/corpus-common-addon/tests/helpers/module-for-acceptance.js
author ymh <ymh.work@gmail.com>
Tue, 08 Nov 2016 11:25:29 +0100
changeset 400 bc39bcecf6a4
parent 136 5fed7e1716c2
child 406 cf0f23803a53
permissions -rw-r--r--
Added tag 0.0.7 for changeset 800d6baf35f7

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

      if (options.beforeEach) {
        options.beforeEach.apply(this, arguments);
      }
    },

    afterEach() {
      if (options.afterEach) {
        options.afterEach.apply(this, arguments);
      }

      destroyApp(this.application);
    }
  });
}