Skip to content
Myr

Added more RedirectHelper specs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 50b5fa8 · Browse files · 2 files+17 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+17 added−2 removed

  • tests:+9 added−2 removed
  • other:+8 added−0 removed

2 files+17 added−2 removed

modified:lib/express.core.js+8 added
37 unmodified lines
38 39 RedirectHelpers : {40 init : function() {41 Express.home = Express.settings.basepath42 },43 44 onRequest : {45 'set back to referrer' : function() {46 Express.back = 47 Express.requestHeader('Referer') ||48 Express.requestHeader('Referrer')49 }50 }51 },52 53 ContentLength : {
650 unmodified lines
modified:spec/spec.core.js+9 added-2 removed
162 unmodified lines
163 it 'should redirect home'164 get('foo', function(){ redirect(home) })165 get('foo').headers.location.should.eql '/'166 end167 168 it 'should not always set location'169 get('foo', function(){ 'bar' })170 get('foo').headers.should.not.have_property 'location'171 end172 end173 174 describe '.back'175 it 'should redirect to the reeferrer'176 uri = 'http://vision-media.ca'171 request = mockRequest({ headers : [['Referer', 'http://vision-media.ca']] })177 request = mockRequest({ headers : [['Referer', uri]] })178 get('foo', function(){ redirect(back) })173 get('foo', { request : request }).headers.location.should.eql 'http://vision-media.ca'179 get('foo', { request : request }).headers.location.should.eql uri180 Express.back.should.eql uri181 end182 end183 end184
51 unmodified lines