Skip to content
Myr

fixed overriding of path by mock request

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

authored by csausdev · committed by TJ Holowaychuk · parent 2594ff4 · Browse files · 6 files+22 added−24 removed
This commit

State

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

Diff stats

6 files+22 added−24 removed

  • tests:+12 added−5 removed
  • other:+10 added−19 removed

6 files+22 added−24 removed

modified:lib/express.cookie.js+1 added-1 removed
modified:lib/express.core.js+1 added-14 removed
306 unmodified lines
307 308 arrayToHash : function(array) {309 var hash = {}310 for (var i = 0, len = array.length; i < len; ++i)311 hash[array[i][0]] = array[i][1]311 hash[array[i][0].toLowerCase()] = array[i][1]312 return hash313 },314 315 /**
406 unmodified lines
722 use(Express.RedirectHelpers)723 724})()725726get('user', function(){727 'Foo'728})729730put('user', function(){731 p('PUT')732})733734del('user', function(){735 p('DELETE')736})737738// Express.start()
modified:lib/express.mocks.js+8 added-4 removed
modified:spec/spec.cookie.js+4 added-1 removed
16 unmodified lines
17 it 'should parse cookie fields'18 get('foo', function() {19 cookie('q')20 })21 response = get('foo', { headers : [['Cookie', 'path=/; q=something; domain=.example.net']] })21 request = mockRequest({ 22 headers : [['Cookie', 'path=/; q=something; domain=.example.net']]23 })24 response = get('foo', { request: request })25 response.body.should.eql 'something'26 end27 end28
19 unmodified lines
modified:spec/spec.core.js+3 added-3 removed
143 unmodified lines
144 145 describe '.arrayToHash()'146 it 'should map an assoc array to an object'147 headers = [['Content-Type', 'text/plain']]148 Express.arrayToHash(headers).should.eql { 'Content-Type' : 'text/plain' }148 Express.arrayToHash(headers).should.eql { 'content-type' : 'text/plain' }149 end150 end151 152 describe '.redirect()'
24 unmodified lines
177 178 describe '.back'179 it 'should redirect to the referrer'180 uri = 'http://vision-media.ca'181 request = mockRequest({ headers : [['Referer', uri]] })181 get('foo', function(){ redirect(back) })182 request = mockRequest({ headers : [['Referer', uri]] })183 get('foo', { request : request }).headers.location.should.eql uri183 get('foo', { request: request }).headers.location.should.eql uri184 Express.back.should.eql uri185 end186 end187 end
52 unmodified lines
modified:spec/spec.node.js+5 added-1 removed
13 unmodified lines
14 })15 promise.wait()16}1718if (process.ARGV[2]) {19 JSpec.exec('spec/spec.'+process.ARGV[2]+'.js') 20} else {21JSpec22 .exec('spec/spec.core.js')23 .exec('spec/spec.routing.js')24 .exec('spec/spec.mocks.js')25 .exec('spec/spec.modules.js')26 .exec('spec/spec.mime.js')27 .exec('spec/spec.cookie.js')28 .exec('spec/spec.session.js')26 .exec('spec/spec.view.js')29 .exec('spec/spec.view.js') 30}31JSpec.run({ formatter : JSpec.formatters.Terminal, failuresOnly : true })32JSpec.report()33