 
     describe "when associated with an unsaved buffer", ->
       it "displays 'untitled' instead of the buffer's path, but still displays the buffer position", ->
-        atom.workspaceView.openSync()
-        StatusBar.activate()
-        statusBar = atom.workspaceView.find('.status-bar').view()
-        expect(StatusBar.fileInfo.currentPath.text()).toBe 'untitled'
-        expect(StatusBar.cursorPosition.text()).toBe '1,1'
+        waitsForPromise ->
+          atom.workspace.open()
+
+        runs ->
+          StatusBar.activate()
+          statusBar = atom.workspaceView.find('.status-bar').view()
+          expect(StatusBar.fileInfo.currentPath.text()).toBe 'untitled'
+          expect(StatusBar.cursorPosition.text()).toBe '1,1'
 
   describe ".deactivate()", ->
     it "removes the StatusBarView", ->

    it "disables the buffer modified indicator on save", ->
      filePath = path.join(os.tmpdir(), "atom-whitespace.txt")
      fs.writeFileSync(filePath, "")
      atom.workspaceView.openSync(filePath)
      editor = atom.workspace.getActivePaneItem()
      expect(StatusBar.fileInfo.bufferModified.text()).toBe ''
      editor.insertText("\n")
      advanceClock(buffer.stoppedChangingDelay)
      expect(StatusBar.fileInfo.bufferModified.text()).toBe '*'
      editor.getBuffer().save()
      expect(StatusBar.fileInfo.bufferModified.text()).toBe ''

    it "disables the buffer modified indicator if the content matches again", ->
      expect(StatusBar.fileInfo.bufferModified.text()).toBe ''

  beforeEach ->
    atom.workspaceView = new WorkspaceView
    atom.workspace = atom.workspaceView.model

    waitsForPromise ->
      atom.workspace.open('sample.js')

    runs ->
      atom.workspaceView.simulateDomAttachment()
      StatusBar.activate()
      editorView = atom.workspaceView.getActiveView()
      editor = editorView.getEditor()
      statusBar = atom.workspaceView.find('.status-bar').view()
      buffer = editor.getBuffer()

  describe "@initialize", ->
    it "appends only one status bar", ->
