Skip to content
Myr

spec.plugins.static.js

This file

Path

spec/spec.plugins.static.js

73 lines · 2.5 KiB · JavaScript

Last changed by

Merge branch 'stream'visionmediabefore adoptionfb5d528

History of this file

Take it

Closes #88.visionmediabefore adoptionb8f54d6

lines 1–2why, one step back
1
2describe 'Express'

Merge branch 'stream'visionmediabefore adoptionfb5d528

line 3why, one step back
3 describe 'Static'

Closes #88.visionmediabefore adoptionb8f54d6

lines 4–7why, one step back
4 before
5 use(require('express/plugins/static').Static, { path: 'spec/fixtures' })6 end7

Merge branch 'stream'visionmediabefore adoptionfb5d528

lines 8–9why, one step back
8 // TODO: spec again when JSpec has async support ... mocking out FileReadStream
9 // is to much of a hassle

Closes #88.visionmediabefore adoptionb8f54d6

line 10why, one step back
10

Merge branch 'stream'visionmediabefore adoptionfb5d528

lines 11–71why, one step back
11 // describe 'GET /public/*'
12 // it 'should transfer static files'13 // get('/public/user.json').body.should.include '"name":'14 // end15 // end16 // 17 // describe '#sendfile()'18 // describe 'when the file exists'19 // it 'should throw an InvalidPathError when .. is found'20 // get('/public/*', function(file){21 // this.sendfile(file)22 // })23 // try { get('/public/../foobar') }24 // catch (e) {25 // e.name.should.eql 'InvalidPathError'26 // e.message.should.eql "`spec/fixtures/../foobar' is not a valid path"27 // }28 // end29 // 30 // it 'should transfer the file'31 // get('/public/*', function(file){32 // this.sendfile('spec/fixtures/' + file)33 // })34 // get('/public/user.json').body.should.include '"name":'35 // end36 // 37 // it 'should automatically set the content type based on extension'38 // get('/public/*', function(file){39 // this.sendfile('spec/fixtures/' + file)40 // })41 // get('/public/user.json').headers['content-type'].should.eql 'application/json'42 // end43 // end44 // end45 // 46 // describe '#download()' 47 // describe 'when the file exists'48 // it 'should set attachment filename'49 // get('/report', function(){50 // this.download('report.pdf')51 // return 'foo'52 // })53 // get('/report').headers['content-disposition'].should.eql 'attachment; filename="report.pdf"'54 // end55 // 56 // it 'should transfer the file'57 // get('/public/*', function(file){58 // this.download('spec/fixtures/' + file)59 // })60 // get('/public/user.json').body.should.include '"name":'61 // end62 // 63 // it 'should automatically set the content type based on extension'64 // get('/public/*', function(file){65 // this.download('spec/fixtures/' + file)66 // })67 // get('/public/user.json').headers['content-type'].should.eql 'application/json'68 // end69 // end70 // end71 //

Closes #88.visionmediabefore adoptionb8f54d6

lines 72–73why, one step back
72 end
73end