Skip to content
Myr

spec.modules.js

This file

Path

spec/spec.modules.js

76 lines · 1.6 KiB · JavaScript

Last changed by

Fixed hookImmutable()visionmediabefore adoption2035c31

History of this file

Take it

Added hookImmutable()visionmediabefore adoption78ee497

lines 1–18why, one step back
1
2use({3 name : 'foo',4 init : function() {5 initCalled = true6 },7 8 settings : {9 one : 1,10 two : 211 },12 13 utilities : {14 foo : function(){15 return 'bar'16 }17 },18

Fixed hookImmutable()visionmediabefore adoption2035c31

lines 19–22why, one step back
19 onFoo : {
20 'return bar' : function(one, two) {21 return 'bar ' + one + ' ' + two22 }

Added hookImmutable()visionmediabefore adoption78ee497

lines 23–24why, one step back
23 },
24

Fixed hookImmutable()visionmediabefore adoption2035c31

lines 25–32why, one step back
25 onFooImmutable : {
26 'test one' : function(immutable, arg) {27 return 'one ' + immutable28 },29 30 'test two' : function(immutable, arg) {31 return immutable + ' two'32 }

Added hookImmutable()visionmediabefore adoption78ee497

lines 33–71why, one step back
33 }
34})3536describe 'Express'37 describe 'Modules'38 before_each39 Express.routes = []40 end41 42 it 'should call init when passed to use()'43 initCalled.should.be_true44 end45 46 it 'should merge utilities'47 Express.utilities.foo().should.eql 'bar'48 end49 50 it 'should expose utilities to routes'51 get('foo', function(){ foo() })52 get('foo').body.should.eql 'bar'53 end54 55 it 'should merge settings'56 Express.settings.foo.one.should.eql 157 Express.settings.foo.two.should.eql 258 end59 60 it 'should throw error when trying to merge settings without module name'61 -{ use({ settings : { foo : 'bar' }}) }.should.throw_error(/module name is required/)62 end63 64 describe 'hook()'65 it 'should call hook implementations returning an array of results'66 Express.hook('onFoo', 'test', 'stuff').should.eql ['bar test stuff']67 end68 end69 70 describe 'hookImmutable'71 it 'should call hook implementations sequencially passing the first argument passed'

Fixed hookImmutable()visionmediabefore adoption2035c31

line 72why, one step back
72 Express.hookImmutable('onFooImmutable', 'test').should.eql 'one test two'

Added hookImmutable()visionmediabefore adoption78ee497

lines 73–76why, one step back
73 end
74 end75 end76end