 
       runs ->
         expect(guestStartedHandler).toHaveBeenCalledWith [
-          { login: 'hubot', clientId: hostSession.clientId }
+          { login: 'hubot', clientId: leaderSession.clientId }
           { login: 'octocat', clientId: guestSession.clientId }
         ]
         expect(guestSession.getParticipants()).toEqual [
-          { login: 'hubot', clientId: hostSession.clientId }
+          { login: 'hubot', clientId: leaderSession.clientId }
           { login: 'octocat', clientId: guestSession.clientId }
         ]
         expect(guestSession.getOtherParticipants()).toEqual [
-          { login: 'hubot', clientId: hostSession.clientId }
+          { login: 'hubot', clientId: leaderSession.clientId }
         ]
 
       waitsFor "host to see guest enter", -> hostParticipantEnteredHandler.callCount > 0
 
       runs ->
         expect(hostParticipantEnteredHandler).toHaveBeenCalledWith(login: 'octocat', clientId: guestSession.clientId)
-        expect(hostSession.getParticipants()).toEqual [
-          { login: 'hubot', clientId: hostSession.clientId }
+        expect(leaderSession.getParticipants()).toEqual [
+          { login: 'hubot', clientId: leaderSession.clientId }
           { login: 'octocat', clientId: guestSession.clientId }
         ]
-        expect(hostSession.getOtherParticipants()).toEqual [
+        expect(leaderSession.getOtherParticipants()).toEqual [
           { login: 'octocat', clientId: guestSession.clientId }
         ]
         guestSession.stop()

        server.stop()

    it "sends the document and file system from the host session to the guest session", ->
      hostSession.start()
      startedHandler = jasmine.createSpy('startedHandler')
      guestSession.on 'started', startedHandler

      waitsFor "host session to start", (started) -> hostSession.one 'started', started

      runs ->
        guestSession.start()

      waitsFor "guest session to receive document", -> guestSession.getDocument()?

      runs ->
        expect(guestSession.mirrorRepository.argsForCall[0][1]).toEqual {url: 'git://server/repo.git'}
        expect(guestSession.getSite().id).toBe 2
        hostSession.getDocument().set('this should', 'replicate')
        guestSession.getDocument().set('this also', 'replicates')

      waitsFor "documents to replicate", ->
        guestSession.getDocument().get('this should') is 'replicate' and
          hostSession.getDocument().get('this also') is 'replicates'

      waitsFor "guest session to start", -> startedHandler.callCount is 1

      runs ->
        expect(repositoryMirrored).toBe true

    it "reports on the participants of the channel", ->
      hostSession.one 'started', hostStartedHandler = jasmine.createSpy("hostStartedHandler")
      guestSession.one 'started', guestStartedHandler = jasmine.createSpy("guestStartedHandler")
      guestSession.one 'stopped', guestStoppedHandler = jasmine.createSpy("guestS")
      hostSession.on 'participant-entered', hostParticipantEnteredHandler = jasmine.createSpy("hostParticipantEnteredHandler")
      hostSession.on 'participant-exited', hostParticipantExitedHandler = jasmine.createSpy("hostParticipantExitedHandler")

      hostSession.start()
      waitsFor "host session to start", -> hostStartedHandler.callCount > 0

      runs ->
        expect(hostStartedHandler).toHaveBeenCalledWith [login: 'hubot', clientId: hostSession.clientId]
        expect(hostSession.getParticipants()).toEqual [login: 'hubot', clientId: hostSession.clientId]
        expect(hostSession.getOtherParticipants()).toEqual []
        token = 'octocat-token'
        guestSession.start()



      runs ->
        expect(hostParticipantExitedHandler).toHaveBeenCalledWith(login: 'octocat', clientId: guestSession.clientId)
        expect(leaderSession.getParticipants()).toEqual [login: 'hubot', clientId: leaderSession.clientId]
        expect(leaderSession.getOtherParticipants()).toEqual []
