spec.plugins.redirect.js
This file
Path
spec/spec.plugins.redirect.js
62 lines · 1.6 KiB · JavaScript
Last changed by
Fixed some cookie specsvisionmediabefore adoption7ca5942
History of this fileTake it
Added redirect() helpervisionmediabefore adoptionff293e5
lines 1–11why, 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 302'11 get('/logout', function(){Fixed some cookie specsvisionmediabefore adoption7ca5942
line 12why, one step back12 this.redirect('/')Added redirect() helpervisionmediabefore adoptionff293e5
lines 13–18why, one step back13 })14 get('/logout').status.should.eql 30215 get('/logout').headers['location'].should.eql '/'16 end17 end18 Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 19why, one step back19 describe 'redirect("back")'Added redirect() helpervisionmediabefore adoptionff293e5
lines 20–21why, one step back20 it 'should check Referrer header'21 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 22why, one step back22 this.redirect('back')Added redirect() helpervisionmediabefore adoptionff293e5
lines 23–29why, one step back23 })24 var response = get('/logout', { headers: { referrer: '/login' }})25 response.headers['location'].should.eql '/login'26 end27 28 it 'should check referer header'29 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 30why, one step back30 this.redirect('back')Added redirect() helpervisionmediabefore adoptionff293e5
lines 31–40why, one step back31 })32 var response = get('/logout', { headers: { referer: '/login' }})33 response.headers['location'].should.eql '/login'34 end35 end36 37 describe 'redirect(home)'38 it 'should check set("home")'39 set('home', '/login')40 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 41why, one step back41 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 42–48why, one step back42 })43 get('/logout').headers['location'].should.eql '/login'44 end45 46 it 'should check set("basepath")'47 set('basepath', '/web/')48 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 49why, one step back49 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 50–55why, one step back50 })51 get('/logout').headers['location'].should.eql '/web/'52 end53 54 it 'should default to "/"'55 get('/logout', function(){Fixed redirect helpers due to Request changevisionmediabefore adoption995cde7
line 56why, one step back56 this.redirect('home')Added redirect() helpervisionmediabefore adoptionff293e5
lines 57–62why, one step back57 })58 get('/logout').headers['location'].should.eql '/'59 end60 end61 end62end