 
     beforeEach () ->
       @richTextInit = sinon.stub()
+      @richTextOpenDoc = sinon.stub()
       window.Frontend = {
         richText: {
-          init: @richTextInit
+          init: @richTextInit,
+          openDoc: @richTextOpenDoc
         }
       }
 


        $compile('<div cm-editor sharejs-doc="sharejsDoc"></div>')($rootScope)
        $rootScope.$digest()

        expect(getSnapshot).to.have.been.called
        expect(setValue).to.have.been.called
        expect(detachFromCM).to.have.been.called
        expect(attachToCM).to.have.been.called

    it 'detaches from CM when destroyed', () ->


    it 'attaches to CM', () ->
      inject ($compile, $rootScope) ->
        getSnapshot = sinon.stub()
        detachFromCM = sinon.stub()
        attachToCM = sinon.stub()
