@@ -23,21 +23,24 @@ function client(srv, nsp, opts){
2323
2424describe ( 'socket.io-mongo' , function ( ) {
2525 beforeEach ( function ( done ) { //initialize collection
26- var cli = mubsub ( 'mongodb://localhost:27017/test' ) ;
26+ var cli = mubsub ( 'mongodb://test:test@ localhost:27017/test' ) ;
2727 var channel = cli . channel ( 'socket.io' ) ;
2828 channel . publish ( 'socket.io' , 'init' , done ) ;
2929 } ) ;
3030
3131 describe ( 'broadcast' , function ( ) {
3232 beforeEach ( function ( done ) {
33- this . mubsubClients = [ ] ;
3433 var self = this ;
35-
36- async . times ( 2 , function ( n , next ) {
37- var cli = mubsub ( 'mongodb://localhost:27017/test' ) ;
34+
35+ var connectOpts = [
36+ 'mongodb://test:test@localhost:27017/test' ,
37+ 'test:test@localhost:27017/test' ,
38+ { host : 'localhost' , port : '27017' , username : 'test' , password : 'test' , db : 'test' }
39+ ] ;
40+
41+ async . times ( 3 , function ( n , next ) {
3842 var srv = http ( ) ;
39- var sio = io ( srv , { adapter : mongoAdapter ( { client : cli } ) } ) ;
40- self . mubsubClients . push ( cli ) ;
43+ var sio = io ( srv , { adapter : mongoAdapter ( connectOpts [ n ] ) } ) ;
4144
4245 srv . listen ( function ( ) {
4346 [ '/' , '/nsp' ] . forEach ( function ( name ) {
@@ -99,12 +102,6 @@ describe('socket.io-mongo', function(){
99102 } ) ;
100103 } ) ;
101104
102- afterEach ( function ( ) {
103- this . mubsubClients . forEach ( function ( cli ) {
104- cli . close ( ) ;
105- } ) ;
106- } ) ;
107-
108105 it ( 'should broadcast from a socket' , function ( done ) {
109106 async . each ( this . sockets . slice ( 1 ) , function ( socket , next ) {
110107 socket . on ( 'broadcast' , function ( message ) {
0 commit comments