Skip to content
Myr

spec.plugins.flash.js

This file

Path

spec/spec.plugins.flash.js

78 lines · 2.9 KiB · JavaScript

Last changed by

Merge branch 'integration'visionmediabefore adoption33443d9

History of this file

Take it

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

Merge branch 'async-plugins'visionmediabefore adoption4c246a4

lines 1–8why, one step back
1
2describe '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()

Merge branch 'integration'visionmediabefore adoption33443d9

lines 9–10why, one step back
9 var sess = new Base(123)
10 Session.store.commit(sess, function(){})

Merge branch 'async-plugins'visionmediabefore adoption4c246a4

lines 11–13why, one step back
11 end
12 13 describe 'Flash'

Typovisionmediabefore adoptione1152f6

line 14why, one step back
14 describe '#flash()'

Fixed Request#flash() specsvisionmediabefore adoptionf2637c6

lines 15–17why, one step back
15 describe 'given a type and msg'
16 it 'should push a flash message'17 var headers = { headers: { cookie: 'sid=123' }}

Revert "Fail to test CI"visionmediabefore adoptionce82a91

line 18why, one step back
18 post('/', function(){ return this.flash('info', 'email sent') })

Fixed Request#flash() specsvisionmediabefore adoptionf2637c6

lines 19–23why, one step back
19 get('/', function(){ return this.flash('info').join(', ') })
20 post('/', headers)21 post('/', headers)22 get('/', headers).body.should.eql 'email sent, email sent'23 end

Merge branch 'async-plugins'visionmediabefore adoption4c246a4

lines 24–25why, one step back
24 end
25

Fixed Request#flash() specsvisionmediabefore adoptionf2637c6

lines 26–45why, one step back
26 describe 'given a type'
27 describe 'when no messages have been pushed'28 it 'should return null'29 var headers = { headers: { cookie: 'sid=123' }}30 get('/', function(){ return this.flash('info') || 'empty' })31 get('/', headers).body.should.eql 'empty'32 end33 end34 35 describe 'when messages have been pushed'36 it 'should persist only until flushed'37 var headers = { headers: { cookie: 'sid=123' }}38 post('/', function(){ return this.flash('info', 'email sent') })39 get('/', function(){ return (this.flash('info') || ['nope!']).join(', ') })40 post('/', headers)41 post('/', headers)42 get('/', headers).body.should.eql 'email sent, email sent'43 get('/', headers).body.should.eql 'nope!'44 end45 end

Request#flash() without args now returns all flashesvisionmediabefore adoption50e0593

lines 46–74why, one step back
46
47 describe 'given no arguments'48 it 'should provide access to all types'49 var flash, headers = { headers: { cookie: 'sid=123' }}50 post('/', function(){ return this.flash('info', 'email sent') })51 post('/error', function(){ return this.flash('error', 'email failed to send') })52 get('/', function(){ return flash = this.flash(), '' })53 post('/', headers)54 post('/', headers)55 post('/error', headers)56 get('/')57 flash.should.eql { info: ['email sent', 'email sent'], error: ['email failed to send'] }58 end59 60 it 'should persist only until flushed'61 var flash, headers = { headers: { cookie: 'sid=123' }}62 post('/', function(){ return this.flash('info', 'email sent') })63 post('/error', function(){ return this.flash('error', 'email failed to send') })64 get('/', function(){ return flash = this.flash(), '' })65 post('/', headers)66 post('/', headers)67 post('/error', headers)68 get('/', headers)69 flash.should.eql { info: ['email sent', 'email sent'], error: ['email failed to send'] }70 get('/', headers)71 flash.should.eql {}72 end73 end74

Merge branch 'async-plugins'visionmediabefore adoption4c246a4

lines 75–78why, one step back
75 end
76 end77 end78end