1 | require('./setup');
|
2 |
|
3 | describe('Events', function() {
|
4 | var app;
|
5 |
|
6 | beforeEach(function() { app = loadFixtureApp('simple'); });
|
7 |
|
8 | var events = [
|
9 | 'load:before',
|
10 | 'initializers:before',
|
11 | 'initializers:after',
|
12 | 'helpers:before',
|
13 | 'helpers:after',
|
14 | 'routes:before',
|
15 | 'routes:after',
|
16 | 'load:after'
|
17 | ];
|
18 |
|
19 | events.forEach(function(e) {
|
20 | it("emit '"+e+"'", function(done) {
|
21 | app.on(e, function() { done(); });
|
22 | app.load();
|
23 | });
|
24 | });
|
25 |
|
26 | it('should emit the right sequence', function(done) {
|
27 | var emitted = [];
|
28 | events.forEach(function(e) {
|
29 | app.on(e, function() { emitted.push(e); });
|
30 | });
|
31 |
|
32 | app.on('load:after', function() {
|
33 | emitted.join(",").should.equal(events.join(","));
|
34 | done();
|
35 | });
|
36 |
|
37 | app.load();
|
38 | });
|
39 | });
|