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

Not known.

History of this file

Take it

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

Merge branch 'flash'visionmediabefore adoption3863a76

lines 1–70why, 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 30315 get('/logout').headers['location'].should.eql '/'16 end17 18 it 'should allow optional status code'19 get('/logout', function(){20 this.redirect('/', 304)21 })22 get('/logout').status.should.eql 30423 get('/logout').headers['location'].should.eql '/'24 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' }})33 response.headers['location'].should.eql '/login'34 end35 36 it 'should check referer header'37 get('/logout', function(){38 this.redirect('back')39 })40 var response = get('/logout', { headers: { referer: '/login' }})41 response.headers['location'].should.eql '/login'42 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 })51 get('/logout').headers['location'].should.eql '/login'52 end53 54 it 'should check set("basepath")'55 set('basepath', '/web/')56 get('/logout', function(){57 this.redirect('home')58 })59 get('/logout').headers['location'].should.eql '/web/'60 end61 62 it 'should default to "/"'63 get('/logout', function(){64 this.redirect('home')65 })66 get('/logout').headers['location'].should.eql '/'67 end68 end69 end70end