spec.plugins.redirect.js
This file
Path
spec/spec.plugins.redirect.js
70 lines · 1.8 KiB · JavaScript
Last changed by
Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
History of this fileTake it
The walk stopped after 200 commits: lines older than fbf547d point at it.
Added Session classvisionmediabefore adoptionfbf547d
lines 1–14why, one step back12describe 'Express'3 before_each4 reset()5 use(require('express/plugins/redirect').Redirect)6 end7 8 describe 'Redirect'9 describe 'redirect()'10 it 'should set status to 303'11 get('/logout', function(){12 this.redirect('/')13 })14 get('/logout').status.should.eql 303Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 15why, one step back15 get('/logout').headers['Location'].should.eql '/'Added Session classvisionmediabefore adoptionfbf547d
lines 16–22why, one step back16 end17 18 it 'should allow optional status code'19 get('/logout', function(){20 this.redirect('/', 304)21 })22 get('/logout').status.should.eql 304Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 23why, one step back23 get('/logout').headers['Location'].should.eql '/'Added Session classvisionmediabefore adoptionfbf547d
lines 24–32why, one step back24 end25 end26 27 describe 'redirect("back")'28 it 'should check Referrer header'29 get('/logout', function(){30 this.redirect('back')31 })32 var response = get('/logout', { headers: { referrer: '/login' }})Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 33why, one step back33 response.headers['Location'].should.eql '/login'Added Session classvisionmediabefore adoptionfbf547d
lines 34–40why, one step back34 end35 36 it 'should check referer header'37 get('/logout', function(){38 this.redirect('back')39 })40 var response = get('/logout', { headers: { referer: '/login' }})Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 41why, one step back41 response.headers['Location'].should.eql '/login'Added Session classvisionmediabefore adoptionfbf547d
lines 42–50why, one step back42 end43 end44 45 describe 'redirect(home)'46 it 'should check set("home")'47 set('home', '/login')48 get('/logout', function(){49 this.redirect('home')50 })Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 51why, one step back51 get('/logout').headers['Location'].should.eql '/login'Added Session classvisionmediabefore adoptionfbf547d
lines 52–58why, one step back52 end53 54 it 'should check set("basepath")'55 set('basepath', '/web/')56 get('/logout', function(){57 this.redirect('home')58 })Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 59why, one step back59 get('/logout').headers['Location'].should.eql '/web/'Added Session classvisionmediabefore adoptionfbf547d
lines 60–65why, one step back60 end61 62 it 'should default to "/"'63 get('/logout', function(){64 this.redirect('home')65 })Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 66why, one step back66 get('/logout').headers['Location'].should.eql '/'Added Session classvisionmediabefore adoptionfbf547d
lines 67–70why, one step back67 end68 end69 end70end