 				done()
 
 	describe 'delete entity :', (done)->
-
 		beforeEach ->
 			@path = "folder/doc1"
 			@type = "mock-type"

			@entity_id = "entity_id_here"
			@entity = _id:@entity_id
			@projectLocator.findElementByPath = (project_id, path, cb)=> cb(null, @entity, @type)

		it 'should get the element id', ->
			@projectLocator.findElementByPath = sinon.spy()

			@splitDocLines = @docLines.split("\n")
			@fs.readFile = sinon.stub().callsArgWith(2, null, @docLines)

			@editorController.setDoc = sinon.stub().callsArg(5)

			@update.write(@docLines)
			@update.end()

		it 'should set the doc text in the editor controller', (done)->
			@updateMerger.p.processDoc @project_id, @doc_id, @user_id, @update, "path", @source, =>
				@editorController.setDoc
					.calledWith(@project_id, @doc_id, @user_id, @splitDocLines, @source)
					.should.equal true
				done()

		it 'should create a new doc when it doesnt exist', (done)->
			folder = {_id:"adslkjioj"}
			docName = "main.tex"
			path = "folder1/folder2/#{docName}"
			@editorController.mkdirpWithoutLock = sinon.stub().callsArgWith(2, null, [folder], folder)
			@editorController.addDocWithoutLock = sinon.stub().callsArg(6)

			@updateMerger.p.processDoc @project_id, undefined, @user_id, @update, path, @source, =>
				@editorController.mkdirpWithoutLock
					.calledWith(@project_id)
					.should.equal true
				@editorController.addDocWithoutLock
					.calledWith(@project_id, folder._id, docName, @splitDocLines, @source, @user_id)
					.should.equal true
				done()

	describe 'processFile :', (done)->
