       atom.workspaceView.attachToDom()
       fs.makeTreeSync(packagePath)
       atom.workspaceView.trigger("package-generator:generate-package")
-      packageGeneratorView = atom.workspaceView.find(".package-generator").view()
-
-      expect(packageGeneratorView.hasParent()).toBeTruthy()
-      expect(packageGeneratorView.error).not.toBeVisible()
-      packageGeneratorView.miniEditor.setText(packagePath)
-      packageGeneratorView.trigger "core:confirm"
-      expect(packageGeneratorView.hasParent()).toBeTruthy()
-      expect(packageGeneratorView.error).toBeVisible()
+
+      waitsForPromise ->
+        activationPromise
+
+      runs ->
+        packageGeneratorView = atom.workspaceView.find(".package-generator").view()
+
+        expect(packageGeneratorView.hasParent()).toBeTruthy()
+        expect(packageGeneratorView.error).not.toBeVisible()
+        packageGeneratorView.miniEditor.setText(packagePath)
+        packageGeneratorView.trigger "core:confirm"
+        expect(packageGeneratorView.hasParent()).toBeTruthy()
+        expect(packageGeneratorView.error).toBeVisible()
 
     it "opens the package", ->
       atom.workspaceView.trigger("package-generator:generate-package")
-      packageGeneratorView = atom.workspaceView.find(".package-generator").view()
-      packageGeneratorView.miniEditor.setText(packagePath)
-      apmExecute = spyOn(packageGeneratorView, 'runCommand').andCallFake (command, args, exit) ->
-        process.nextTick -> exit()
-      loadPackage = spyOn(atom.packages, 'loadPackage')
-      packageGeneratorView.trigger "core:confirm"
+
+      waitsForPromise ->
+        activationPromise
+
+      runs ->
+        packageGeneratorView = atom.workspaceView.find(".package-generator").view()
+        packageGeneratorView.miniEditor.setText(packagePath)
+        apmExecute = spyOn(packageGeneratorView, 'runCommand').andCallFake (command, args, exit) ->
+          process.nextTick -> exit()
+        loadPackage = spyOn(atom.packages, 'loadPackage')
+        packageGeneratorView.trigger "core:confirm"
 
       waitsFor ->
         atom.open.callCount is 1

            expect(enablePackage.mostRecentCall.args[0]).toBe packageName

    describe 'when creating a theme', ->
      beforeEach -> atom.workspaceView.trigger("package-generator:generate-syntax-theme")

      describe "when the theme is created outside of the packages directory", ->
        it "calls `apm init` and `apm link`", ->

      packageName = "CamelCaseIsForTheBirds"
      packagePath = path.join(path.dirname(packagePath), packageName)
      atom.workspaceView.trigger("package-generator:generate-package")

      waitsForPromise ->
        activationPromise

      runs ->
        packageGeneratorView = atom.workspaceView.find(".package-generator").view()
        packageGeneratorView.miniEditor.setText(packagePath)
        apmExecute = spyOn(packageGeneratorView, 'runCommand')
        packageGeneratorView.trigger "core:confirm"

        expect(apmExecute).toHaveBeenCalled()
        expect(apmExecute.mostRecentCall.args[0]).toBe atom.packages.getApmPath()
        expect(apmExecute.mostRecentCall.args[1]).toEqual ['init', '--package', "#{path.join(path.dirname(packagePath), "camel-case-is-for-the-birds")}"]

    describe 'when creating a package', ->
      beforeEach ->
        atom.workspaceView.trigger("package-generator:generate-package")

        waitsForPromise ->
          activationPromise

      describe "when the package is created outside of the packages directory", ->
        it "calls `apm init` and `apm link`", ->
