import { module } from 'qunit';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';

export default function(name, options = {}) {
  module(name, {
    beforeEach: function() {
      this.application = startApp();
      if (options.beforeEach) {
        options.beforeEach.call(this, arguments);
      }
    },

    afterEach: function() {
      destroyApp(this.application);
      if (options.afterEach) {
        options.afterEach.call(this, arguments);
      }
    }
  });
}

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() {
      destroyApp(this.application);

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

Fix beforeEach/afterEach callbacks with moduleForAcceptance.
Fix beforeEach/afterEach callbacks with moduleForAcceptance.

These were previously calling the provided `beforeEach`/`afterEach`
blocks with a single argument (that is the original arguments object)
instead of the correct arguments.

Updated to use `.apply` instead of `.call`.
