       runs ->
         buffer = atom.project.bufferForPathSync()
         buffer.setText "<div class='name'><%= User.find(2).full_name %></div>"
-        tokenizedBuffer = new TokenizedBuffer({
-          buffer, grammarRegistry: atom.grammars, packageManager: atom.packages,
-          assert: atom.assert, tabLength: 2,
-        })
-        tokenizedBuffer.setGrammar(atom.grammars.selectGrammar('test.erb'))
+        tokenizedBuffer = new TokenizedBuffer({buffer, grammar: atom.grammars.selectGrammar('test.erb'), tabLength: 2})
         fullyTokenize(tokenizedBuffer)
 
         {tokens} = tokenizedBuffer.tokenizedLines[0]

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

      it "deserializes it searching among the buffers in the current project", ->
        tokenizedBufferA = new TokenizedBuffer({
          buffer, grammarRegistry: atom.grammars, packageManager: atom.packages,
          assert: atom.assert, 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", ->

      buffer = atom.project.bufferForPathSync('sample.js')
      buffer.insert [10, 0], "  // multi-line\n  // comment\n  // block\n"
      buffer.insert [0, 0], "// multi-line\n// comment\n// block\n"
      tokenizedBuffer = new TokenizedBuffer({buffer, grammar: atom.grammars.grammarForScopeName('source.js'), tabLength: 2})
      fullyTokenize(tokenizedBuffer)

    it "includes the first line of multi-line comments", ->
