spec.plugins.js
This file
Path
spec/spec.plugins.js
41 lines · 906 bytes · JavaScript
Last changed by
Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
History of this fileTake it
The walk stopped after 200 commits: lines older than fbf547d point at it.
Added Session classvisionmediabefore adoptionfbf547d
line 1why, one step back1mime() is no longer global. Renamed to exports.type()visionmediabefore adoption2a4f352
lines 2–3why, one step back2var mime = require('express/mime')3Added Session classvisionmediabefore adoptionfbf547d
lines 4–11why, one step back4CSSColors = Plugin.extend({5 extend: {6 init: function() {7 this.initialized = true8 }9 },10 on: {11 response: function(event) {Merge branch 'master' of http://github.com/visionmedia/expressGuillermo Rauchbefore adoption8ef6a0b
line 12why, one step back12 if (event.response.headers['Content-Type'] === mime.type('css'))Added Session classvisionmediabefore adoptionfbf547d
lines 13–41why, one step back13 event.response.body = event.response.body.replace('black', '#000')14 }15 }16})1718describe 'Express'19 describe 'use()'20 before_each21 reset()22 use(CSSColors)23 end24 25 it 'should call .init on plugins when available'26 CSSColors.initialized.should.be_true27 end28 29 describe 'events'30 describe 'response'31 it 'should be triggered before headers and body are sent'32 get('/style.css', function(){33 this.contentType('css')34 return 'body { color: black; }'35 })36 get('/style.css').body.should.eql 'body { color: #000; }'37 end38 end39 end40 end41end