                   expect(error).ok
                   done()
 
-        it 'should check existing rooms before adding new ones', (done) ->
-          chatServer = new ChatService { port : port }, null, state
-          chatServer.chatState.addRoom roomName1, ->
-            chatServer.chatState.addRoom roomName1, (error, data) ->
-              expect(error).ok
-              done()
-
-        it 'should check existing rooms before removing a room', (done) ->
-          chatServer = new ChatService { port : port }, null, state
-          chatServer.chatState.removeRoom roomName1, (error, data) ->
-            expect(error).ok
-            done()
+        it 'should list all rooms', (done) ->
+          chatServer = new ChatService { port : port }, null, state
+          room1 = new Room chatServer, roomName1
+          room1.initState { whitelistOnly : true }, ->
+            room2 = new Room chatServer, roomName2
+            chatServer.chatState.addRoom room1, ->
+              chatServer.chatState.addRoom room2, ->
+                socket1 = ioClient.connect url1, makeParams(user1)
+                socket1.on 'loginConfirmed', ->
+                  socket1.emit 'listRooms', (error, data) ->
+                    expect(data).an('array')
+                    expect(data).include(roomName2)
+                    expect(data).include(roomName1)
+                    done()
+
+        it 'should send access remove on room delete', (done) ->
+          chatServer = new ChatService { port : port
+            , enableRoomsManagement : true }
+          , null, state
+          room = new Room chatServer, roomName1
+          room.roomState.ownerSet user1, ->
+            chatServer.chatState.addRoom room, ->
+              socket1 = ioClient.connect url1, makeParams(user1)
+              socket1.on 'loginConfirmed', ->
+                socket1.emit 'roomJoin', roomName1, (error, data) ->
+                  socket1.emit 'roomDelete', roomName1
+                  socket1.once 'roomAccessRemoved', (r) ->
+                    expect(r).equal(roomName1)
+                    done()
+
+
+      describe 'Room messaging', ->
 
         it 'should emit join and leave for user\'s sockets', (done) ->
           chatServer = new ChatService { port : port }, null, state

                  expect(data).include(user1)
                  done()


        it 'should reject send lists to not joined users', (done) ->
          chatServer = new ChatService { port : port }, null, state
          room = new Room chatServer, roomName1

              expect(error).ok
              done()

        it 'should check for existing user names on deleting' , (done) ->
          chatServer = new ChatService { port : port
            , enableDirectMessages : true }
          , null, state
          socket1 = ioClient.connect url1, makeParams(user1)
          socket1.on 'loginConfirmed', ->
            socket1.emit 'directRemoveFromList', 'blacklist', [user2]
            , (error, data) ->
              expect(error).ok
              done()

        it 'should check for existing list names on adding' , (done) ->
          chatServer = new ChatService { port : port
            , enableDirectMessages : true }
          , null, state
          socket1 = ioClient.connect url1, makeParams(user1)
          socket1.on 'loginConfirmed', ->
            socket1.emit 'directAddToList', 'blacklist', [user2]
            , (error, data) ->
              expect(error).not.ok
              socket1.emit 'directAddToList', 'blacklist', [user2]
              , (error, data) ->
                expect(error).ok
                done()

        it 'should allow user to modify own mode', (done) ->
          chatServer = new ChatService { port : port
            , enableDirectMessages : true }
