     it 'should load app', (done) ->
 
       globals.config.apps.InternalApp = name: 'InternalApp'
-      expect.spyOn KodingAppsController, 'loadInternalApp'
+      spy = expect.spyOn KodingAppsController, 'loadInternalApp'
 
       appManager.create 'InternalApp', {}
 

ApplicationManager   = require '../lib/applicationmanager'
KodingAppsController = require '../lib/kodingappscontroller'

appManager = null
createApps = (appNames = [], shouldShow) ->



      isRegistered = no
      appInstance  = new AppController name: 'FooApp'
      spy = expect.spyOn appManager, 'setListeners'

      appManager.on 'AppRegistered', -> isRegistered = yes
      appManager.register appInstance
