@@ -366,42 +366,14 @@ describe('jasmine adapter', function () {
366
366
jasmineEnv = new jasmine . Env ( )
367
367
} )
368
368
369
- it ( 'should set random order' , function ( ) {
370
- jasmineConfig . random = true
371
- spyOn ( jasmineEnv , 'randomizeTests' )
369
+ it ( 'should pass jasmineConfig directly to jasmine.configure' , function ( ) {
370
+ var configure = spyOn ( jasmineEnv , 'configure' )
372
371
373
- createStartFn ( tc , jasmineEnv ) ( )
374
-
375
- expect ( jasmineEnv . randomizeTests ) . toHaveBeenCalledWith ( true )
376
- } )
377
-
378
- it ( 'should set order seed' , function ( ) {
379
- var seed = '4321'
380
-
381
- jasmineConfig . seed = seed
382
- spyOn ( jasmineEnv , 'seed' )
372
+ jasmineConfig . foo = 42
383
373
384
374
createStartFn ( tc , jasmineEnv ) ( )
385
375
386
- expect ( jasmineEnv . seed ) . toHaveBeenCalledWith ( seed )
387
- } )
388
-
389
- it ( 'should set stopOnFailure' , function ( ) {
390
- jasmineConfig . stopOnFailure = true
391
- spyOn ( jasmineEnv , 'throwOnExpectationFailure' )
392
-
393
- createStartFn ( tc , jasmineEnv ) ( )
394
-
395
- expect ( jasmineEnv . throwOnExpectationFailure ) . toHaveBeenCalledWith ( true )
396
- } )
397
-
398
- it ( 'should set failFast' , function ( ) {
399
- jasmineConfig . failFast = true
400
- spyOn ( jasmineEnv , 'stopOnSpecFailure' )
401
-
402
- createStartFn ( tc , jasmineEnv ) ( )
403
-
404
- expect ( jasmineEnv . stopOnSpecFailure ) . toHaveBeenCalledWith ( true )
376
+ expect ( configure ) . toHaveBeenCalledWith ( jasmineConfig )
405
377
} )
406
378
407
379
it ( 'should change timeoutInterval' , function ( ) {
@@ -416,29 +388,6 @@ describe('jasmine adapter', function () {
416
388
jasmine . DEFAULT_TIMEOUT_INTERVAL = previousTimeoutInterval
417
389
} )
418
390
419
- it ( 'should not set random order if client does not pass it' , function ( ) {
420
- spyOn ( jasmineEnv , 'randomizeTests' )
421
-
422
- createStartFn ( tc , jasmineEnv ) ( )
423
-
424
- expect ( jasmineEnv . randomizeTests ) . not . toHaveBeenCalled ( )
425
- } )
426
-
427
- it ( 'should not fail with failFast if the jasmineEnv does not support it' , function ( ) {
428
- jasmineConfig . failFast = true
429
- jasmineEnv . stopOnSpecFailure = null
430
-
431
- expect ( function ( ) {
432
- createStartFn ( tc , jasmineEnv ) ( )
433
- } ) . not . toThrowError ( )
434
- } )
435
-
436
- it ( 'should not change timeoutInterval if client does not pass it' , function ( ) {
437
- createStartFn ( tc , jasmineEnv ) ( )
438
-
439
- expect ( jasmine . DEFAULT_TIMEOUT_INTERVAL ) . toBe ( jasmine . DEFAULT_TIMEOUT_INTERVAL )
440
- } )
441
-
442
391
it ( 'should not fail if client does not set config' , function ( ) {
443
392
tc . config = null
444
393
@@ -601,18 +550,31 @@ describe('jasmine adapter', function () {
601
550
} )
602
551
603
552
describe ( 'createSpecFilter' , function ( ) {
553
+ var jasmineEnv
554
+
555
+ beforeEach ( function ( ) {
556
+ jasmineEnv = new jasmine . Env ( )
557
+ } )
558
+
604
559
it ( 'should create spec filter in jasmine' , function ( ) {
605
- var jasmineEnvMock = { }
606
560
var karmaConfMock = {
607
561
args : [ '--grep' , 'test' ]
608
562
}
609
- var specMock = {
610
- getFullName : jasmine . createSpy ( 'getFullName' ) . and . returnValue ( 'test' )
611
- }
612
563
613
- createSpecFilter ( karmaConfMock , jasmineEnvMock )
564
+ createSpecFilter ( karmaConfMock , jasmineEnv )
565
+
566
+ var specFilter = jasmineEnv . configuration ( ) . specFilter
567
+
568
+ // Jasmine's default specFilter **always** returns true
569
+ // so test multiple possibilities
570
+
571
+ expect ( specFilter ( {
572
+ getFullName : jasmine . createSpy ( 'getFullName' ) . and . returnValue ( 'test' )
573
+ } ) ) . toEqual ( true )
614
574
615
- expect ( jasmineEnvMock . specFilter ( specMock ) ) . toEqual ( true )
575
+ expect ( specFilter ( {
576
+ getFullName : jasmine . createSpy ( 'getFullName2' ) . and . returnValue ( 'foo' )
577
+ } ) ) . toEqual ( false )
616
578
} )
617
579
} )
618
580
} )
0 commit comments