         activationPromise
         atom.workspace.open(samplePath).then (_editor) ->
           editor          = _editor
-          editorElement   = atom.views.getView(_editor)
-          editorCommander = getCommander editorElement
-
-      workspaceElement   = atom.views.getView(atom.workspace)
-      workspaceCommander = getCommander workspaceElement
+          editorCommander = getCommander atom.views.getView(_editor)
+      workspaceCommander = getCommander atom.views.getView(atom.workspace)
 
     moveTo = (point) ->
       editor.setCursorBufferPosition point


  describe "activation", ->
    beforeEach ->
      activationPromise = atom.packages.activatePackage('clip-history')
      waitsForPromise ->
        activationPromise

    describe "when activated", ->
      it "history entries is empty", ->
        expect(getMain().history.entries).toHaveLength 0

      it "wrap original atom.clipboard with new one", ->
        expect(getMain().atomClipboardWrite).not.toEqual(atom.clipboard.write)

        expect(getMain().atomClipboardWrite).toEqual(atom.clipboard.write)

  describe "history", ->
    [history, commander, main, workspaceElement, editor, editorElement] = []

    beforeEach ->
      atom.config.set('clip-history.max', 3)
      waitsForPromise ->
        atom.packages.activatePackage 'clip-history'

    afterEach ->
      atom.packages.deactivatePackage 'clip-history'
