     path = "/tmp/atom-whitespace.txt"
     fsUtils.writeSync(path, "")
     window.rootView = new RootView
-    rootView.open(path)
+    editor = project.open(path)
 
     atom.activatePackage('whitespace')
 
     rootView.focus()
-    editor = rootView.getActiveView()
 
   afterEach ->
     fsUtils.remove(path) if fsUtils.exists(path)

      grammar = syntax.addGrammar.argsForCall[0][0]

    it "trims GFM text with a single space", ->
      editor.activeEditSession.setGrammar(grammar)
      editor.insertText "foo \nline break!"
      editor.getBuffer().save()
      expect(editor.getText()).toBe "foo\nline break!\n"

    it "leaves GFM text with double spaces alone", ->
      editor.activeEditSession.setGrammar(grammar)
      editor.insertText "foo  \nline break!"
      editor.getBuffer().save()
      expect(editor.getText()).toBe "foo  \nline break!\n"

    it "trims GFM text with a more than two spaces", ->
      editor.activeEditSession.setGrammar(grammar)
      editor.insertText "foo   \nline break!"
      editor.getBuffer().save()
      expect(editor.getText()).toBe "foo\nline break!\n"

    expect(editor.getText()).toBe "foo\nbar\n\nbaz"

    # works for buffers that are opened after extension is initialized
    editor = project.open(require.resolve('fixtures/sample.txt'))
    editor.moveCursorToEndOfLine()
    editor.insertText("           ")

