         expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
 
       it "emits a warning notification when the user does not have permission", ->
-        spyOn(Pane::, 'saveActiveItem').andCallFake ->
+        spyOn(editor, 'save').andCallFake ->
           error = new Error("EACCES, permission denied '/Some/dir/and-a-file.js'")
           error.code = 'EACCES'
           error.path = '/Some/dir/and-a-file.js'

        expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'

      it "emits a warning notification when the operation is not permitted", ->
        spyOn(Pane::, 'saveActiveItem').andCallFake ->
          error = new Error("EPERM, operation not permitted '/Some/dir/and-a-file.js'")
          error.code = 'EPERM'
          error.path = '/Some/dir/and-a-file.js'
          throw error

      it "emits a warning notification when the file is already open by another app", ->
        spyOn(Pane::, 'saveActiveItem').andCallFake ->
          error = new Error("EBUSY, resource busy or locked '/Some/dir/and-a-file.js'")
          error.code = 'EBUSY'
          error.path = '/Some/dir/and-a-file.js'

          expect(editor.isModified()).toBeTruthy()

  describe "::saveActivePaneItem()", ->
    editor = null
    beforeEach ->
      waitsForPromise ->
        atom.workspace.open('sample.js').then (o) -> editor = o

    describe "when there is an error", ->
      it "emits a warning notification when the file cannot be saved", ->
        spyOn(editor, 'save').andCallFake ->
          throw new Error("'/some/file' is a directory")

        atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
