           chatService.state.getUser user1
           .then (user) ->
             orig = user.userState.removeAllSocketsFromRoom
-            user.userState.removeAllSocketsFromRoom = ->
-              orig.apply user.userState, arguments
-              .then -> throw new Error()
-            setCustomCleanup (cb) ->
-              user.userState.removeAllSocketsFromRoom = orig
+            user.userState.__proto__.removeAllSocketsFromRoom = ->
+              Promise.reject new Error()
+            setCustomCleanup (cb) ->
+              user.userState.__proto__.removeAllSocketsFromRoom = orig
               chatService.close cb
             chatService.execUserCommand true
             , 'roomAddToList', roomName1, 'blacklist', [user1]

            ], done

  it 'should emit consistencyFailure on leave room errors', (done) ->
    chatService = startService { state : 'memory' }
    chatService.addRoom roomName1, null, ->
      socket1 = clientConnect user1
      socket1.on 'loginConfirmed', ->

          chatService.state.getRoom roomName1
          .then (room) ->
            orig = room.leave
            room.__proto__.leave = ->
              Promise.reject new Error()
            setCustomCleanup (cb) ->
              room.__proto__.leave = orig
              chatService.close cb
            async.parallel [
              (cb) ->
