     expect(editor.getText()).toBe "foo\nbar\n\nbaz"
 
     # works for buffers that are opened after extension is initialized
-    editor = project.openSync('sample.txt')
+    editor = atom.project.openSync('sample.txt')
     editor.moveCursorToEndOfLine()
     editor.insertText("           ")
 

  describe "whitespace.ensureSingleTrailingNewline config", ->
    [originalConfigValue] = []
    beforeEach ->
      originalConfigValue = config.get("whitespace.ensureSingleTrailingNewline")
      expect(originalConfigValue).toBe true

    afterEach ->
      config.set("whitespace.ensureSingleTrailingNewline", originalConfigValue)

    it "adds a trailing newline when there is no trailing newline", ->
      editor.insertText "foo"

    grammar = null

    beforeEach ->
      spyOn(atom.syntax, "addGrammar").andCallThrough()
      atom.packages.activatePackage("language-gfm", sync: true)
      expect(atom.syntax.addGrammar).toHaveBeenCalled()
      grammar = atom.syntax.addGrammar.argsForCall[0][0]

    it "trims GFM text with a single space", ->
      editor.setGrammar(grammar)
