spec.plugins.js
This file
Path
spec/spec.plugins.js
39 lines · 889 bytes · JavaScript
Last changed by
Added Event data arg specvisionmediabefore adoption3d4d62a
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839
CSSColors = Plugin.extend({ on: { response: function(event) { if (event.response.headers['content-type'] == mime('css')) event.response.body = event.response.body.replace('black', '#000') } }})
describe 'Express' describe 'use()' before_each reset() use(CSSColors) end describe 'Event' describe '#init()' it 'should accept arbitrary data' var event = new Event('foo', { bar: 'baz' }) event.bar.should.eql 'baz' end end end describe 'events' describe 'response' it 'should be triggered before headers and body are sent' get('/style.css', function(){ contentType('css') return 'body { color: black; }' }) get('/style.css').body.should.eql 'body { color: #000; }' end end end endend