 
           runs ->
             expect(finderView.list.find("li:contains(sample.js)")).toExist()
-
-  describe "fuzzy find by content under cursor", ->
-    editor = null
-
-    beforeEach ->
-      editor = rootView.getActiveView()
-      rootView.attachToDom()
-
-    it "opens the fuzzy finder window when there are multiple matches", ->
-      editor.setText("sample")
-      rootView.trigger 'fuzzy-finder:find-under-cursor'
-
-      waitsFor ->
-        finderView.list.children('li').length > 0
-
-      runs ->
-        expect(finderView).toBeVisible()
-        expect(rootView.find('.fuzzy-finder input:focus')).toExist()
-
-    it "opens a file directly when there is a single match", ->
-      editor.setText("sample.txt")
-      rootView.trigger 'fuzzy-finder:find-under-cursor'
-
-      openedPath = null
-      spyOn(rootView, "open").andCallFake (path) ->
-        openedPath = path
-
-      waitsFor ->
-        openedPath != null
-
-      runs ->
-        expect(finderView).not.toBeVisible()
-        expect(openedPath).toBe project.resolve("sample.txt")
-
-    it "displays an error when the word under the cursor doesn't match any files", ->
-      editor.setText("moogoogaipan")
-      editor.setCursorBufferPosition([0,5])
-
-      rootView.trigger 'fuzzy-finder:find-under-cursor'
-
-      waitsFor ->
-        finderView.is(':visible')
-
-      runs ->
-        expect(finderView.error.text().length).toBeGreaterThan 0
-
-    it "displays error when there is no word under the cursor", ->
-      editor.setText("&&&&&&&&&&&&&&& sample")
-      editor.setCursorBufferPosition([0,5])
-
-      rootView.trigger 'fuzzy-finder:find-under-cursor'
-
-      waitsFor ->
-        finderView.is(':visible')
-
-      runs ->
-        expect(finderView.error.text().length).toBeGreaterThan 0
-
-  describe "opening a path into a split", ->
-    it "opens the path by splitting the active editor left", ->
-      expect(rootView.getPanes().length).toBe 1
-      pane = rootView.getActivePane()
-      spyOn(pane, "splitLeft").andCallThrough()
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      {filePath} = finderView.getSelectedElement()
-      finderView.miniEditor.trigger 'pane:split-left'
-
-      expect(rootView.getPanes().length).toBe 2
-      expect(pane.splitLeft).toHaveBeenCalled()
-      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)
-
-    it "opens the path by splitting the active editor right", ->
-      expect(rootView.getPanes().length).toBe 1
-      pane = rootView.getActivePane()
-      spyOn(pane, "splitRight").andCallThrough()
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      {filePath} = finderView.getSelectedElement()
-      finderView.miniEditor.trigger 'pane:split-right'
-
-      expect(rootView.getPanes().length).toBe 2
-      expect(pane.splitRight).toHaveBeenCalled()
-      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)
-
-    it "opens the path by splitting the active editor up", ->
-      expect(rootView.getPanes().length).toBe 1
-      pane = rootView.getActivePane()
-      spyOn(pane, "splitUp").andCallThrough()
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      {filePath} = finderView.getSelectedElement()
-      finderView.miniEditor.trigger 'pane:split-up'
-
-      expect(rootView.getPanes().length).toBe 2
-      expect(pane.splitUp).toHaveBeenCalled()
-      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)
-
-    it "opens the path by splitting the active editor down", ->
-      expect(rootView.getPanes().length).toBe 1
-      pane = rootView.getActivePane()
-      spyOn(pane, "splitDown").andCallThrough()
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      {filePath} = finderView.getSelectedElement()
-      finderView.miniEditor.trigger 'pane:split-down'
-
-      expect(rootView.getPanes().length).toBe 2
-      expect(pane.splitDown).toHaveBeenCalled()
-      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)
-
-  describe "git status decorations", ->
-    [originalText, originalPath, editor, newPath] = []
-
-    beforeEach ->
-      rootView.attachToDom()
-      editor = rootView.getActiveView()
-      originalText = editor.getText()
-      originalPath = editor.getPath()
-      newPath = project.resolve('newsample.js')
-      fs.writeSync(newPath, '')
-
-    afterEach ->
-      fs.writeSync(originalPath, originalText)
-      fs.remove(newPath) if fs.exists(newPath)
-
-    describe "when a modified file is shown in the list", ->
-      it "displays the modified icon", ->
-        editor.setText('modified')
-        editor.activeEditSession.save()
-        project.getRepo().getPathStatus(editor.getPath())
-
-        rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-        expect(finderView.find('.status.status-modified').length).toBe 1
-        expect(finderView.find('.status.status-modified').closest('li').find('.file').text()).toBe 'sample.js'
-
-    describe "when a new file is shown in the list", ->
-      it "displays the new icon", ->
-        rootView.open('newsample.js')
-        editor = rootView.getActiveView()
-        project.getRepo().getPathStatus(editor.getPath())
-
-        rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-        expect(finderView.find('.status.status-added').length).toBe 1
-        expect(finderView.find('.status.status-added').closest('li').find('.file').text()).toBe 'newsample.js'
-
-  describe "when the filter text contains a colon followed by a number", ->
-    it "opens the selected path to that line number", ->
-      rootView.attachToDom()
-      expect(rootView.find('.fuzzy-finder')).not.toExist()
-      [editor] = rootView.getEditors()
-      expect(editor.getCursorBufferPosition()).toEqual [0, 0]
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      expect(rootView.find('.fuzzy-finder')).toExist()
-      finderView.miniEditor.insertText(':4')
-      finderView.trigger 'core:confirm'
-
-      expect(editor.getCursorBufferPosition()).toEqual [3, 4]
-
-      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
-      expect(rootView.find('.fuzzy-finder')).toExist()
-      finderView.miniEditor.insertText(':10')
-      finderView.miniEditor.trigger 'pane:split-left'
-
-      expect(rootView.getActiveView()).not.toBe editor
-      expect(rootView.getActiveView().getCursorBufferPosition()).toEqual [9, 2]

          expect(editor4.getPath()).toBe expectedPath
          expect(editor4.isFocused).toBeTruthy()

  describe "git-status-finder behavior", ->
    [originalText, originalPath, newPath] = []

    beforeEach ->
      editor = rootView.getActiveView()
      originalText = editor.getText()
      originalPath = editor.getPath()
      fs.writeSync(originalPath, 'making a change for the better')
      project.getRepo().getPathStatus(originalPath)

      newPath = project.resolve('newsample.js')
      fs.writeSync(newPath, '')
      project.getRepo().getPathStatus(newPath)

    afterEach ->
      fs.writeSync(originalPath, originalText)
      fs.remove(newPath) if fs.exists(newPath)

    it "displays all new and modified paths", ->
      expect(rootView.find('.fuzzy-finder')).not.toExist()
      rootView.trigger 'fuzzy-finder:toggle-git-status-finder'
      expect(rootView.find('.fuzzy-finder')).toExist()

      expect(finderView.find('.file').length).toBe 2

      expect(finderView.find('.status.status-modified').length).toBe 1
      expect(finderView.find('.status.status-added').length).toBe 1

  describe "common behavior between file and buffer finder", ->
    describe "when the fuzzy finder is cancelled", ->
      describe "when an editor is open", ->

        rootView.trigger 'fuzzy-finder:toggle-file-finder'
        expect(PathLoader.startTask).toHaveBeenCalled()

  it "ignores paths that match entries in config.fuzzyFinder.ignoredNames", ->
    config.set("fuzzyFinder.ignoredNames", ["tree-view.js"])
    rootView.trigger 'fuzzy-finder:toggle-file-finder'
    finderView.maxItems = Infinity

    waitsFor ->
      finderView.list.children('li').length > 0

    runs ->
      expect(finderView.list.find("li:contains(tree-view.js)")).not.toExist()

  describe "fuzzy find by content under cursor", ->
    editor = null

    beforeEach ->
      editor = rootView.getActiveView()
      rootView.attachToDom()

    it "opens the fuzzy finder window when there are multiple matches", ->
      editor.setText("sample")
      rootView.trigger 'fuzzy-finder:find-under-cursor'

      waitsFor ->
        finderView.list.children('li').length > 0

      runs ->
        expect(finderView).toBeVisible()
        expect(rootView.find('.fuzzy-finder input:focus')).toExist()

    it "opens a file directly when there is a single match", ->
      editor.setText("sample.txt")
      rootView.trigger 'fuzzy-finder:find-under-cursor'

      openedPath = null
      spyOn(rootView, "open").andCallFake (path) ->
        openedPath = path

      waitsFor ->
        openedPath != null

      runs ->
        expect(finderView).not.toBeVisible()
        expect(openedPath).toBe project.resolve("sample.txt")

    it "displays an error when the word under the cursor doesn't match any files", ->
      editor.setText("moogoogaipan")
      editor.setCursorBufferPosition([0,5])

      rootView.trigger 'fuzzy-finder:find-under-cursor'

      waitsFor ->
        finderView.is(':visible')

      runs ->
        expect(finderView.error.text().length).toBeGreaterThan 0

    it "displays error when there is no word under the cursor", ->
      editor.setText("&&&&&&&&&&&&&&& sample")
      editor.setCursorBufferPosition([0,5])

      rootView.trigger 'fuzzy-finder:find-under-cursor'

      waitsFor ->
        finderView.is(':visible')

      runs ->
        expect(finderView.error.text().length).toBeGreaterThan 0

  describe "opening a path into a split", ->
    it "opens the path by splitting the active editor left", ->
      expect(rootView.getPanes().length).toBe 1
      pane = rootView.getActivePane()
      spyOn(pane, "splitLeft").andCallThrough()

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      {filePath} = finderView.getSelectedElement()
      finderView.miniEditor.trigger 'pane:split-left'

      expect(rootView.getPanes().length).toBe 2
      expect(pane.splitLeft).toHaveBeenCalled()
      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)

    it "opens the path by splitting the active editor right", ->
      expect(rootView.getPanes().length).toBe 1
      pane = rootView.getActivePane()
      spyOn(pane, "splitRight").andCallThrough()

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      {filePath} = finderView.getSelectedElement()
      finderView.miniEditor.trigger 'pane:split-right'

      expect(rootView.getPanes().length).toBe 2
      expect(pane.splitRight).toHaveBeenCalled()
      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)

    it "opens the path by splitting the active editor up", ->
      expect(rootView.getPanes().length).toBe 1
      pane = rootView.getActivePane()
      spyOn(pane, "splitUp").andCallThrough()

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      {filePath} = finderView.getSelectedElement()
      finderView.miniEditor.trigger 'pane:split-up'

      expect(rootView.getPanes().length).toBe 2
      expect(pane.splitUp).toHaveBeenCalled()
      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)

    it "opens the path by splitting the active editor down", ->
      expect(rootView.getPanes().length).toBe 1
      pane = rootView.getActivePane()
      spyOn(pane, "splitDown").andCallThrough()

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      {filePath} = finderView.getSelectedElement()
      finderView.miniEditor.trigger 'pane:split-down'

      expect(rootView.getPanes().length).toBe 2
      expect(pane.splitDown).toHaveBeenCalled()
      expect(rootView.getActiveView().getPath()).toBe project.resolve(filePath)

  describe "when the filter text contains a colon followed by a number", ->
    it "opens the selected path to that line number", ->
      rootView.attachToDom()
      expect(rootView.find('.fuzzy-finder')).not.toExist()
      [editor] = rootView.getEditors()
      expect(editor.getCursorBufferPosition()).toEqual [0, 0]

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      expect(rootView.find('.fuzzy-finder')).toExist()
      finderView.miniEditor.insertText(':4')
      finderView.trigger 'core:confirm'

      expect(editor.getCursorBufferPosition()).toEqual [3, 4]

      rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
      expect(rootView.find('.fuzzy-finder')).toExist()
      finderView.miniEditor.insertText(':10')
      finderView.miniEditor.trigger 'pane:split-left'

      expect(rootView.getActiveView()).not.toBe editor
      expect(rootView.getActiveView().getCursorBufferPosition()).toEqual [9, 2]

  describe "Git integration", ->
    describe "git-status-finder behavior", ->
      [originalText, originalPath, newPath] = []

      beforeEach ->
        editor = rootView.getActiveView()
        originalText = editor.getText()
        originalPath = editor.getPath()
        fs.writeSync(originalPath, 'making a change for the better')
        project.getRepo().getPathStatus(originalPath)

        newPath = project.resolve('newsample.js')
        fs.writeSync(newPath, '')
        project.getRepo().getPathStatus(newPath)

      afterEach ->
        fs.writeSync(originalPath, originalText)
        fs.remove(newPath)

      it "displays all new and modified paths", ->
        expect(rootView.find('.fuzzy-finder')).not.toExist()
        rootView.trigger 'fuzzy-finder:toggle-git-status-finder'
        expect(rootView.find('.fuzzy-finder')).toExist()

        expect(finderView.find('.file').length).toBe 2

        expect(finderView.find('.status.status-modified').length).toBe 1
        expect(finderView.find('.status.status-added').length).toBe 1

    describe "status decorations", ->
      [originalText, originalPath, editor, newPath] = []

      beforeEach ->
        rootView.attachToDom()
        editor = rootView.getActiveView()
        originalText = editor.getText()
        originalPath = editor.getPath()
        newPath = project.resolve('newsample.js')
        fs.writeSync(newPath, '')

      afterEach ->
        fs.writeSync(originalPath, originalText)
        fs.remove(newPath) if fs.exists(newPath)

      describe "when a modified file is shown in the list", ->
        it "displays the modified icon", ->
          editor.setText('modified')
          editor.activeEditSession.save()
          project.getRepo().getPathStatus(editor.getPath())

          rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
          expect(finderView.find('.status.status-modified').length).toBe 1
          expect(finderView.find('.status.status-modified').closest('li').find('.file').text()).toBe 'sample.js'

      describe "when a new file is shown in the list", ->
        it "displays the new icon", ->
          rootView.open('newsample.js')
          editor = rootView.getActiveView()
          project.getRepo().getPathStatus(editor.getPath())

          rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
          expect(finderView.find('.status.status-added').length).toBe 1
          expect(finderView.find('.status.status-added').closest('li').find('.file').text()).toBe 'newsample.js'

    describe "when core.excludeVcsIgnoredPaths is set to true", ->
      beforeEach ->
