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