11describe ( 'Runner' , function ( ) {
2- var scenario , runner , log , Describe , It , $scenario ;
2+ var scenario , runner , log , Describe , It , $scenario , body ;
33
44 function logger ( text ) {
5- return function ( ) { log += text ; } ;
5+ return function ( done ) {
6+ log += text ;
7+ ( done || noop ) ( ) ;
8+ } ;
69 }
710
811 beforeEach ( function ( ) {
912 log = '' ;
1013 scenario = { } ;
11- runner = new angular . scenario . Runner ( scenario ) ;
14+ body = _jQuery ( '<div></div>' ) ;
15+ runner = new angular . scenario . Runner ( scenario , _jQuery ) ;
1216 Describe = scenario . describe ;
1317 It = scenario . it ;
1418 $scenario = scenario . $scenario ;
@@ -105,4 +109,28 @@ describe('Runner', function(){
105109 } ) ;
106110 } ) ;
107111
112+ describe ( 'run' , function ( ) {
113+ var next ;
114+ it ( 'should execute all specs' , function ( ) {
115+ Describe ( 'd1' , function ( ) {
116+ It ( 'it1' , function ( ) { $scenario . addStep ( 's1' , logger ( 's1,' ) ) ; } ) ;
117+ It ( 'it2' , function ( ) {
118+ $scenario . addStep ( 's2' , logger ( 's2,' ) ) ;
119+ $scenario . addStep ( 's2.2' , function ( done ) { next = done ; } ) ;
120+ } ) ;
121+ } ) ;
122+ Describe ( 'd2' , function ( ) {
123+ It ( 'it3' , function ( ) { $scenario . addStep ( 's3' , logger ( 's3,' ) ) ; } ) ;
124+ It ( 'it4' , function ( ) { $scenario . addStep ( 's4' , logger ( 's4,' ) ) ; } ) ;
125+ } ) ;
126+
127+ $scenario . run ( body ) ;
128+
129+ expect ( log ) . toEqual ( 's1,s2,' ) ;
130+ next ( ) ;
131+ expect ( log ) . toEqual ( 's1,s2,s3,s4,' ) ;
132+
133+ } ) ;
134+ } ) ;
135+
108136} ) ;
0 commit comments