 describe 'kd.singletons.appManager', ->
 
 
-  beforeEach -> appManager = new ApplicationManager
+  beforeEach ->
+
+    spy        = null
+    appManager = new ApplicationManager
+
+
+  afterEach ->
+
+    if spy
+      spy.restore()
+      expect.restoreSpies()
+      spy = null
 
 
   describe 'constructor', ->


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

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


    it 'should warn if there is no name', ->

      spy = expect.spyOn kd, 'warn'

      appManager.tell()
      expect(kd.warn).toHaveBeenCalled()


