spec.plugins.flash.js
This file
Path
spec/spec.plugins.flash.js
32 lines · 1.1 KiB · JavaScript
Last changed by
Added flash support. Closes #64visionmediabefore adoption9727fac
History of this fileTake it
Start flash specsvisionmediabefore adoption5cadbcb
lines 1–11why, one step back12describe 'Express'3 before_each4 reset()5 use(require('express/plugins/cookie').Cookie)6 use(require('express/plugins/session').Session)7 use(require('express/plugins/flash').Flash)8 Session.store.clear()9 end10 11 describe 'Flash'Added flash support. Closes #64visionmediabefore adoption9727fac
lines 12–30why, one step back12 describe 'flash()'13 it 'should push a flash message'14 var headers = { headers: { cookie: 'sid=123' }}15 post('/', function(){ return this.flash('info', 'email sent') })16 get('/', function(){ return this.flash('info', 'email received') })17 get('/info', function(){ return this.flash('info').join(', ') || 'empty' })18 get('/messages', function(){ return this.flash('info').join(', ') || 'empty' })19 20 post('/', headers).body.should.eql 'email sent'21 get('/', headers).body.should.eql 'email received'22 get('/info', headers).body.should.eql 'email sent, email received'23 // TODO: seperate once segfault is fixed...24 end25 26 it 'should return the message pushed'27 get('/', function(){ return this.flash('info', 'email sent') })28 get('/').body.should.eql 'email sent'29 end30 endStart flash specsvisionmediabefore adoption5cadbcb
lines 31–32why, one step back31 end32end