Skip to content
Myr

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 file

Take it

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

Added Session classvisionmediabefore adoptionfbf547d

lines 1–14why, one step back
1
2describe '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 303

Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b

line 15why, one step back
15 get('/logout').headers['Location'].should.eql '/'

Added Session classvisionmediabefore adoptionfbf547d

lines 16–22why, one step back
16 end
17 18 it 'should allow optional status code'19 get('/logout', function(){20 this.redirect('/', 304)21 })22 get('/logout').status.should.eql 304

Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b

line 23why, one step back
23 get('/logout').headers['Location'].should.eql '/'

Added Session classvisionmediabefore adoptionfbf547d

lines 24–32why, one step back
24 end
25 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 back
33 response.headers['Location'].should.eql '/login'

Added Session classvisionmediabefore adoptionfbf547d

lines 34–40why, one step back
34 end
35 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 back
41 response.headers['Location'].should.eql '/login'

Added Session classvisionmediabefore adoptionfbf547d

lines 42–50why, one step back
42 end
43 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 back
51 get('/logout').headers['Location'].should.eql '/login'

Added Session classvisionmediabefore adoptionfbf547d

lines 52–58why, one step back
52 end
53 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 back
59 get('/logout').headers['Location'].should.eql '/web/'

Added Session classvisionmediabefore adoptionfbf547d

lines 60–65why, one step back
60 end
61 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 back
66 get('/logout').headers['Location'].should.eql '/'

Added Session classvisionmediabefore adoptionfbf547d

lines 67–70why, one step back
67 end
68 end69 end70end