equal
deleted
inserted
replaced
1 import { module } from 'qunit'; |
1 import { module } from 'qunit'; |
|
2 import Ember from 'ember'; |
2 import startApp from '../helpers/start-app'; |
3 import startApp from '../helpers/start-app'; |
3 import destroyApp from '../helpers/destroy-app'; |
4 import destroyApp from '../helpers/destroy-app'; |
|
5 |
|
6 const { RSVP: { Promise } } = Ember; |
4 |
7 |
5 export default function(name, options = {}) { |
8 export default function(name, options = {}) { |
6 module(name, { |
9 module(name, { |
7 beforeEach() { |
10 beforeEach() { |
8 this.application = startApp(); |
11 this.application = startApp(); |
9 |
12 |
10 if (options.beforeEach) { |
13 if (options.beforeEach) { |
11 options.beforeEach.apply(this, arguments); |
14 return options.beforeEach.apply(this, arguments); |
12 } |
15 } |
13 }, |
16 }, |
14 |
17 |
15 afterEach() { |
18 afterEach() { |
16 if (options.afterEach) { |
19 let afterEach = options.afterEach && options.afterEach.apply(this, arguments); |
17 options.afterEach.apply(this, arguments); |
20 return Promise.resolve(afterEach).then(() => destroyApp(this.application)); |
18 } |
|
19 |
|
20 destroyApp(this.application); |
|
21 } |
21 } |
22 }); |
22 }); |
23 } |
23 } |