 
       createApps [ 'App1', 'App2', 'App3' ], yes
       appManager.on 'AppIsBeingShown', -> isEventEmitted = yes
-      expect.spyOn appManager, 'setLastActiveIndex'
+      spy = expect.spyOn appManager, 'setLastActiveIndex'
 
       expect(appManager.getFrontApp().options.name).toBe 'App3'
 

      createApps [ 'FooApp', 'BarApp' ]

      appManager.on 'AppIsBeingShown', -> isAppShown = yes
      expect.spyOn appManager, 'setLastActiveIndex'

      appManager.appControllers.FooApp.instances.first.appIsShown = ->
        isAppIsShownCallbackExecuted = yes

    it 'should load app', (done) ->

      globals.config.apps.InternalApp = name: 'InternalApp'
      spy = expect.spyOn KodingAppsController, 'loadInternalApp'

      appManager.create 'InternalApp', {}

