   describe "focus editor after compile", ->
     beforeEach ->
       atom.config.set "coffee-compile.focusEditorAfterCompile", true
-      atom.workspaceView.attachToDom()
+
+      waitsForPromise "coffee-compile package to activate", ->
+        atom.packages.activatePackage('coffee-compile')
 
       waitsForPromise ->
         atom.workspace.open "test.coffee"

  describe "when the editor's grammar is not coffeescript", ->
    it "should not preview compiled js", ->
      atom.config.set "coffee-compile.grammars", []
      atom.workspaceView.attachToDom()

      waitsForPromise ->
        atom.workspace.open "coffee-compile-fixtures.coffee"

CoffeeCompileView = require '../lib/coffee-compile-view'
{WorkspaceView} = require 'atom'

describe "CoffeeCompile", ->
  beforeEach ->
    atom.workspaceView = new WorkspaceView
    atom.workspace     = atom.workspaceView.model

    waitsForPromise "language-coffee-script to activate", ->
      atom.packages.activatePackage('language-coffee-script')
