More specs fixed
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 995cde7 · Browse files · 3 files·+71 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
3 files+71 added−2 removed
- tests:+70 added−1 removed
- other:+1 added−1 removed
Provenance
- Commit
14befd6- Tree
5629ae0- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
995cde7
3 files changed+71 added−2 removed
modified:lib/express/plugins/method-override.js+1 added-1 removed
3 unmodified lines456788910113 unmodified linesexports.MethodOverride = Plugin.extend({ on: { request: function(event) { if (event.request.param('__method__')) event.request.method = param('__method__').toLowerCase() event.request.method = event.request.param('__method__').toLowerCase() } }})No newline at end of fileNo newline at end of fileadded:spec/spec.helpers.js+69 added
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
describe 'Express' describe 'parseParams()' it 'should parse simple query string key / value pairs' parseParams('foo=bar').should.eql { foo: 'bar' } parseParams('foo=bar&baz=1').should.eql { foo: 'bar', baz: '1' } end it 'should parse named nested params' var user = { user: { name: 'tj', email: 'tj@vision-media.ca' }} parseParams('user[name]=tj&user[email]=tj@vision-media.ca').should.eql user end it 'should parse several levels of nesting' var user = { user: { name: 'tj', email: { primary: 'tj@vision-media.ca' }}} parseParams('user[name]=tj&user[email][primary]=tj@vision-media.ca').should.eql user end it 'should convert + to literal space' parseParams('foo=bar+baz++that').should.eql { foo: 'bar baz that' } parseParams('user[name]=tj+holowaychuk').should.eql { user: { name: 'tj holowaychuk' }} end it 'should decode hex literals' parseParams('foo=bar%20baz%20%20that').should.eql { foo: 'bar baz that' } parseParams('user[name]=tj%20holowaychuk').should.eql { user: { name: 'tj holowaychuk' }} end end describe 'toArray()' describe 'when given an array' it 'should return the array' toArray([1,2,3]).should.eql [1,2,3] end end describe 'when given an object with indexed values and length' it 'should return an array' var args = -{ return arguments }('foo', 'bar') toArray(args).should.eql ['foo', 'bar'] end end end describe 'escape()' it 'should escape html' escape('<p>this & that').should.eql '<p>this & that' end end describe 'extname()' it 'should return the a files extension' extname('image.png').should.eql 'png' extname('image.large.png').should.eql 'png' extname('/path/to/image.large.png').should.eql 'png' end it 'should return null when not found' extname('path').should.be_null extname('/just/a/path').should.be_null end end describe 'dirname()' it 'should return the directory path' dirname('/path/to/images/foo.bar.png').should.eql '/path/to/images' end endendNo newline at end of filemodified:spec/spec.plugins.content-length.js+1 added-1 removed
15 unmodified lines161718192020212223244 unmodified lines15 unmodified lines end it 'should not override when manually set' get('/style.css', function(){ header('content-length', 10) this.header('content-length', 10) return 'body { background: #000; }' }) get('/style.css').headers['content-length'].should.eql 10 end4 unmodified lines