 
         describe 'setRunningKernelFor', ->
             it 'should set the running kernel for a grammar', ->
-                kernelManager.setRunningKernelFor mockGrammar, mockKernel
+                grammar =
+                    name: 'grammarLanguage'
+
+                kernel =
+                    kernelSpec:
+                        language: 'kernelLanguage'
+                    destroy: ->
+                kernelManager.setRunningKernelFor grammar, kernel
                 expect(kernelManager._runningKernels.grammarlanguage)
                     .not.toBeUndefined()
                 expect(kernelManager._runningKernels.grammarlanguage


        describe 'destroyRunningKernelFor', ->
            it 'should destroy a running kernel for a grammar', ->
                mockKernels =
                    grammarlanguage: _.clone mockKernel
                    kernel2: _.clone mockKernel

                spyOn(mockKernels.grammarlanguage, 'destroy')
                spyOn(mockKernels.kernel2, 'destroy')
                kernelManager._runningKernels = _.clone mockKernels
                kernelManager.destroyRunningKernelFor mockGrammar

                expect(mockKernels.grammarlanguage.destroy).toHaveBeenCalled()
                expect(mockKernels.kernel2.destroy).not.toHaveBeenCalled()
                expect(kernelManager._runningKernels.kernel2).not.toBeUndefined()
                expect(kernelManager._runningKernels.grammarlanguage).toBeUndefined()


        it 'should read lower case name from grammar', ->
            expect(kernelManager.getLanguageFor mockGrammar)
                .toEqual('grammarlanguage')

    describe 'handle kernelspecs', ->
        firstKernelSpecString = '''{


    describe 'handle running kernels', ->
        mockGrammar =
            name: 'Kernel1'

        mockKernel =
            kernelSpec:
                language: 'kernel1'
            destroy: ->

        mockKernel2 =
            kernelSpec:
                language: 'kernel2'
            destroy: ->

        mockKernels =
            kernel1: mockKernel
            kernel2: mockKernel2

        describe 'destroy', ->
            it 'should destroy all running kernels', ->
                spyOn(mockKernels.kernel1, 'destroy')
                spyOn(mockKernels.kernel2, 'destroy')
                kernelManager._runningKernels = mockKernels
