UNPKG

821 Btext/coffeescriptView Raw
1
2should = require('chai').should()
3rack = require '../.'
4express = require 'express.io'
5easyrequest = require 'request'
6fs = require 'fs'
7
8describe 'a static asset builder', ->
9 app = null
10
11 it 'should work', (done) ->
12 staticPath = "#{__dirname}/fixtures/static"
13 compiled = fs.readFileSync "#{staticPath}/blank.txt", 'utf8'
14 app = express().http()
15 app.use new rack.StaticAssets
16 dirname: staticPath
17 urlPrefix: '/static'
18 app.listen 7076, ->
19 easyrequest 'http://localhost:7076/static/blank.txt', (error, response, body) ->
20 response.headers['content-type'].should.equal 'text/plain'
21 body.should.equal compiled
22 done()
23
24 afterEach (done) -> process.nextTick ->
25 app.server.close done