     atom.project.setPath(atom.project.resolve('tree-view'))
     atom.workspaceView = new WorkspaceView
 
-    atom.packages.activatePackage("tree-view")
-    atom.workspaceView.trigger 'tree-view:toggle'
-    treeView = atom.workspaceView.find(".tree-view").view()
-    treeView.root = treeView.find('ol > li:first').view()
-    sampleJs = treeView.find('.file:contains(tree-view.js)')
-    sampleTxt = treeView.find('.file:contains(tree-view.txt)')
-
-    expect(treeView.root.directory.getSubscriptionCount()).toBeGreaterThan 0
+    waitsForPromise ->
+      atom.packages.activatePackage("tree-view")
+
+    runs ->
+      atom.workspaceView.trigger 'tree-view:toggle'
+      treeView = atom.workspaceView.find(".tree-view").view()
+      treeView.root = treeView.find('ol > li:first').view()
+      sampleJs = treeView.find('.file:contains(tree-view.js)')
+      sampleTxt = treeView.find('.file:contains(tree-view.txt)')
+
+      expect(treeView.root.directory.getSubscriptionCount()).toBeGreaterThan 0
 
   describe ".initialize(project)", ->
     it "renders the root of the project and its contents alphabetically with subdirectories first in a collapsed state", ->

          expect(fs.absolute(treeView.root.getPath())).toBe fs.absolute(projectPath)
          expect(treeView.root.parent()).toMatchSelector(".tree-view")


    describe "when the root view is opened to a file path", ->
      it "does not attach to the root view but does create a root node when initialized", ->
        atom.packages.deactivatePackage("tree-view")
        atom.packages.packageStates = {}
        atom.workspaceView.openSync('tree-view.js')
        treeView = atom.packages.activatePackage("tree-view").mainModule.createView()
        expect(treeView.hasParent()).toBeFalsy()
        expect(treeView.root).toExist()

    describe "when the root view is opened to a directory", ->
      it "attaches to the root view", ->
        treeView = atom.packages.activatePackage("tree-view").mainModule.createView()
        expect(treeView.hasParent()).toBeTruthy()
        expect(treeView.root).toExist()

    describe "when the project is a .git folder", ->
      it "does not create the tree view", ->

      beforeEach ->
        atom.project.setPath(undefined)
        atom.packages.deactivatePackage("tree-view")

        waitsForPromise ->
          atom.packages.activatePackage("tree-view")

        runs ->
          treeView = atom.packages.getActivePackage("tree-view").mainModule.createView()

      it "does not attach to the root view or create a root node when initialized", ->
        expect(treeView.hasParent()).toBeFalsy()
