     [filePath, bufferToDelete] = []
 
     beforeEach (done) ->
-      filePath = join(temp.dir, 'atom-file-to-delete.txt')
+      tempDir = temp.mkdirSync()
+      filePath = join(tempDir, 'atom-file-to-delete.txt')
       fs.writeFileSync(filePath, 'delete me')
       bufferToDelete = new TextBuffer({filePath, load: false})
       filePath = bufferToDelete.getPath() # symlinks may have been converted

        done()

    afterEach ->
      bufferToDelete.destroy()

    describe "when the file is modified", ->
      beforeEach (done) ->

      , 30)

    describe "when the buffer is in an unmodified state before the file is modified on disk", ->
      [event1, event2] = []
      beforeEach (done) ->
        calls = 0
        buffer.onDidChange (args) ->
          calls = calls + 1
          event1 = args if calls is 1
          event2 = args if calls is 2
          done() if calls > 1
        fs.writeFileSync(filePath, "second")
        expect(calls).toBe(0)

      it "changes the in-memory contents of the buffer to match the new disk contents and notifies ::onDidChange observers", ->
        expect(event1.oldRange).toEqual [[0, 0], [0, 0]]
        expect(event1.newRange).toEqual [[0, 0], [0, 6]]
        expect(event1.oldText).toBe ""
        expect(event1.newText).toBe "second"

        expect(event2.oldRange).toEqual [[0, 6], [0, 11]]
        expect(event2.newRange).toEqual [[0, 6], [0, 6]]
        expect(event2.oldText).toBe "first"
        expect(event2.newText).toBe ""

        expect(buffer.isModified()).toBeFalsy()

