spec.plugins.js
This file
Path
spec/spec.plugins.js
39 lines · 864 bytes · JavaScript
Last changed by
Calling Plugin.init() when availablevisionmediabefore adoption78d538a
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839
CSSColors = Plugin.extend({ extend: { init: function() { this.initialized = true } }, 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 it 'should call .init on plugins when available' CSSColors.initialized.should.be_true end describe 'events' describe 'response' it 'should be triggered before headers and body are sent' get('/style.css', function(){ this.contentType('css') return 'body { color: black; }' }) get('/style.css').body.should.eql 'body { color: #000; }' end end end endend