       expect(buffer.lineForRow(0)).toBe "var quicksort = function () {"
 
   describe "::setText(text)", ->
-    beforeEach (done) ->
+    beforeEach ->
       filePath = require.resolve('./fixtures/sample.js')
-      buffer = new TextBuffer({filePath, load: false})
-      buffer.load().then ->
-        done()
+      buffer = TextBuffer.loadSync(filePath)
 
     describe "when the buffer contains newlines", ->
       it "changes the entire contents of the buffer and emits a change event", ->

    beforeEach (done) ->
      filePath = require.resolve('./fixtures/sample.js')
      fileContents = fs.readFileSync(filePath, 'utf8')
      buffer = new TextBuffer({filePath, load: false})
      buffer.load().then ->
        changeHandler = jasmine.createSpy('changeHandler')
        buffer.onDidChange changeHandler
        done()

      fs.moveSync(filePath, newPath)

  describe "::onWillThrowWatchError", ->
    it "notifies observers when the file has a watch error", ->
      filePath = temp.openSync('atom').path
      fs.writeFileSync(filePath, '')

      buffer = TextBuffer.loadSync(filePath)

      eventHandler = jasmine.createSpy('eventHandler')
      buffer.onWillThrowWatchError(eventHandler)

      buffer.file.emitter.emit 'will-throw-watch-error', 'arg'
      expect(eventHandler).toHaveBeenCalledWith 'arg'

  describe "::getLines()", ->
    it "returns an array of lines in the text contents", ->
      filePath = require.resolve('./fixtures/sample.js')
      fileContents = fs.readFileSync(filePath, 'utf8')
      buffer = TextBuffer.loadSync(filePath)
      expect(buffer.getLines().length).toBe fileContents.split("\n").length
      expect(buffer.getLines().join('\n')).toBe fileContents

  describe "::setTextInRange(range, string)", ->
    changeHandler = null
