       editor2.destroy()
 
   describe "when the editor is constructed with an initialLine option", ->
-    it "and positions the cursor on the specified line", ->
-      editor = atom.project.openSync('sample.js', initialLine: 2)
-      buffer = editor.buffer
-      expect(editor.getCursor().getBufferPosition().row).toEqual 2
+    it "positions the cursor on the specified line", ->
+      editor = null
+
+      waitsForPromise ->
+        atom.workspace.open('sample.less', initialLine: 5).then (o) -> editor = o
+
+      runs ->
+        buffer = editor.buffer
+        expect(editor.getCursor().getBufferPosition().row).toEqual 5
 
   describe ".copy()", ->
     it "returns a different edit session with the same initial state", ->
       editor.setSelectedBufferRange([[1, 2], [3, 4]])
-      editor.addSelectionForBufferRange([[5, 6], [7, 8]], isReversed: true)
+      editor.addSelectionForBufferRange([[5, 6], [7, 8]], reversed: true)
       editor.foldBufferRow(4)
       expect(editor.isFoldedAtBufferRow(4)).toBeTruthy()
 


  describe "soft-tabs detection", ->
    it "assigns soft / hard tabs based on the contents of the buffer, or uses the default if unknown", ->
      editor = atom.project.openSync('sample.js', softTabs: false)
      expect(editor.getSoftTabs()).toBeTruthy()

      editor = atom.project.openSync('sample-with-tabs.coffee', softTabs: true)
      expect(editor.getSoftTabs()).toBeFalsy()

      editor = atom.project.openSync(null, softTabs: false)
      expect(editor.getSoftTabs()).toBeFalsy()

  describe ".indentLevelForLine(line)", ->
    it "returns the indent level when the line has only leading whitespace", ->


      describe "when the grammar is updated", ->
        it "retokenizes existing buffers that contain tokens that match the injection selector", ->
          waitsForPromise ->
            atom.workspace.open('sample.js').then (o) -> editor = o

          runs ->
            editor.setText("// SELECT * FROM OCTOCATS")

            {tokens} = editor.lineForScreenRow(0)
            expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS"
            expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"]

          waitsForPromise ->
            atom.packages.activatePackage('package-with-injection-selector')
