 
         runs ->
           buffer = new TextBuffer(text: "# hello\n# world")
-          tokenizedBuffer = new TokenizedBuffer({
-            buffer, grammarRegistry: atom.grammars, packageManager: atom.packages,
-            assert: atom.assert, tabLength: 2,
-          })
-          tokenizedBuffer.setGrammar(atom.grammars.selectGrammar(".coffee"))
+          tokenizedBuffer = new TokenizedBuffer({buffer, grammar: atom.grammars.grammarForScopeName("source.coffee"), tabLength: 2})
           fullyTokenize(tokenizedBuffer)
 
           iterator = tokenizedBuffer.buildIterator()

        })

        buffer = new TextBuffer(text: 'start x\nend x\nx')
        tokenizedBuffer = new TokenizedBuffer({
          buffer, grammarRegistry: atom.grammars, packageManager: atom.packages,
          assert: atom.assert, tabLength: 2,
        })
        tokenizedBuffer.setGrammar(grammar)
        fullyTokenize(tokenizedBuffer)

        iterator = tokenizedBuffer.buildIterator()

          atom.packages.activatePackage('language-coffee-script')

      it "deserializes it searching among the buffers in the current project", ->
        tokenizedBufferA = new TokenizedBuffer({buffer, tabLength: 2})
        tokenizedBufferB = TokenizedBuffer.deserialize(JSON.parse(JSON.stringify(tokenizedBufferA.serialize())), atom)
        expect(tokenizedBufferB.buffer).toBe(tokenizedBufferA.buffer)

    describe "when the underlying buffer has no path", ->
