spec.plugins.js
This file
Path
spec/spec.plugins.js
46 lines · 1.1 KiB · JavaScript
Last changed by
use() now accepts options [#45]visionmediabefore adoption31ac31d
History of this fileTake it
Started Pluginvisionmediabefore adoption8158a3d
line 1why, one step back1CSSVariables -> CSSColors examplevisionmediabefore adoption5c7341c
line 2why, one step back2CSSColors = Plugin.extend({Started Pluginvisionmediabefore adoption8158a3d
line 3why, one step back3 on: {e -> eventvisionmediabefore adoption60b4571
lines 4–6why, one step back4 response: function(event) {5 if (event.response.headers['content-type'] == mime('css'))6 event.response.body = event.response.body.replace('black', '#000')Started Pluginvisionmediabefore adoption8158a3d
lines 7–14why, one step back7 }8 }9})1011describe 'Express'12 describe 'use()'13 before_each14 reset()CSSVariables -> CSSColors examplevisionmediabefore adoption5c7341c
line 15why, one step back15 use(CSSColors)Started Pluginvisionmediabefore adoption8158a3d
lines 16–17why, one step back16 end17 use() now accepts options [#45]visionmediabefore adoption31ac31d
lines 18–24why, one step back18 describe 'with options provided'19 it 'should merge properties'20 use(CSSColors, { foo: 'bar' })21 $(Express.plugins).last().should.have_property 'foo', 'bar'22 end23 end24 Added Event data arg specvisionmediabefore adoption3d4d62a
lines 25–33why, one step back25 describe 'Event'26 describe '#init()'27 it 'should accept arbitrary data'28 var event = new Event('foo', { bar: 'baz' })29 event.bar.should.eql 'baz'30 end31 end32 end33 Started Pluginvisionmediabefore adoption8158a3d
line 34why, one step back34 describe 'events'Added Event data arg specvisionmediabefore adoption3d4d62a
line 35why, one step back35 describe 'response'Started Pluginvisionmediabefore adoption8158a3d
lines 36–46why, one step back36 it 'should be triggered before headers and body are sent'37 get('/style.css', function(){38 contentType('css')39 return 'body { color: black; }'40 })41 get('/style.css').body.should.eql 'body { color: #000; }'42 end43 end44 end45 end46end