File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 318
318
ex . _argumentConstraintsMet = true ;
319
319
ex . _matchingInvocations = [ ] ;
320
320
ex . _mockImplementation = null ;
321
- ex . mock = function ( implementation ) { ex . _mockImplementation = implementation } ;
322
- ex . stub = function ( ) { ex . _mockImplementation = emptyFunction } ;
321
+ ex . mock = function ( implementation ) { ex . _mockImplementation = implementation ; return ex ; } ;
322
+ ex . stub = function ( ) { ex . _mockImplementation = emptyFunction ; return ex ; } ;
323
323
ex . returnValue = function ( v ) { ex . _mockImplementation = function ( ) { return v ; } }
324
324
ex . atLeast = function ( n ) { ex . _times = parseTimes ( n ) ; ex . _timesModifier = 1 ; return ex ; }
325
325
ex . atMost = function ( n ) { ex . _times = parseTimes ( n ) ; ex . _timesModifier = - 1 ; return ex ; }
Original file line number Diff line number Diff line change @@ -302,8 +302,10 @@ describe('Jack API', {
302
302
}
303
303
304
304
jack ( function ( ) {
305
+ var returnValueFromJackStub =
305
306
jack . expect ( "jQuery.ajax" ) . stub ( ) ;
306
307
jQuery . ajax ( ) ;
308
+ value_of ( returnValueFromJackStub ) . should_not_be_undefined ( ) ;
307
309
} ) ;
308
310
309
311
value_of ( realJQueryAjaxCalled ) . should_be_false ( ) ;
@@ -321,17 +323,20 @@ describe('Jack API', {
321
323
}
322
324
323
325
jack ( function ( ) {
326
+ var returnValueFromJackMock =
324
327
jack . grab ( "jQuery.ajax" ) . mock ( function ( ) {
325
328
mockJQueryAjaxCalled = true ;
326
329
return expectedReturnValue ;
327
330
} ) ;
328
331
actualReturnValue = jQuery . ajax ( ) ;
332
+ value_of ( returnValueFromJackMock ) . should_not_be_undefined ( ) ;
329
333
} ) ;
330
334
331
335
value_of ( realJQueryAjaxCalled ) . should_be_false ( ) ;
332
336
value_of ( mockJQueryAjaxCalled ) . should_be_true ( ) ;
333
337
value_of ( actualReturnValue ) . should_be ( expectedReturnValue ) ;
334
338
339
+
335
340
window . jQuery = null ;
336
341
}
337
342
,
You can’t perform that action at this time.
0 commit comments