Skip to content
Myr

spec.plugins.hooks.js

This file

Path

spec/spec.plugins.hooks.js

46 lines · 1.1 KiB · JavaScript

Last changed by

Merge branch 'plugin-halt'visionmediabefore adoption1879648

History of this file

Take it

The walk stopped after 200 commits: lines older than 0186659 point at it.

Fixed upload app submit button stylingvisionmediabefore adoption0186659

lines 1–4why, one step back
1
2describe 'Express'3 before_each4 reset()

Merge branch 'plugin-halt'visionmediabefore adoption1879648

lines 5–8why, one step back
5 hooks = require('express/plugins/hooks')
6 use(hooks.Hooks)7 hooks.callbacks.before = []8 hooks.callbacks.after = []

Fixed upload app submit button stylingvisionmediabefore adoption0186659

lines 9–21why, one step back
9 end
10 11 describe 'Hooks'12 describe 'before()'13 it 'should be called before every request'14 GLOBAL.before(function(){15 this.response.body = 'foo'16 })17 GLOBAL.before(function(){18 this.response.body += 'bar'19 })20 get('/user', function(){})21 get('/user').body.should.eql 'foobar'

Merge branch 'plugin-halt'visionmediabefore adoption1879648

lines 22–30why, one step back
22 end
23 24 it 'should be able to halt the request'25 GLOBAL.before(function(){26 this.halt(404, 'woo!')27 })28 get('/user', function(){ return 'fail' })29 get('/user').status.should.eql 40430 get('/user').body.should.eql 'woo!'

Fixed upload app submit button stylingvisionmediabefore adoption0186659

lines 31–46why, one step back
31 end
32 end33 34 describe 'after()'35 it 'should be called after every request'36 var body37 GLOBAL.after(function(){38 body = this.response.body39 })40 get('/user', function(){ return 'test' })41 get('/user').body.should.eql 'test'42 body.should.eql 'test'43 end44 end45 end46end