 				@error = new Error("Something went wrong")
 				@ShareJsUpdateManager._sendError = sinon.stub()
 				@model.getSnapshot.callsArgWith(1, @error)
-				@ShareJsUpdateManager.applyUpdate @project_id, @doc_id, @update, (err, docLines, version) =>
+				@ShareJsUpdateManager.applyUpdate @project_id, @doc_id, @update, @lines, @version, (err, docLines, version) =>
 					@callback(err, docLines, version)
 					done()
 

				@error = new Error("Something went wrong")
				@ShareJsUpdateManager._sendError = sinon.stub()
				@model.applyOp = sinon.stub().callsArgWith(2, @error)
				@ShareJsUpdateManager.applyUpdate @project_id, @doc_id, @update, (err, docLines, version) =>
					@callback(err, docLines, version)
					done()


			@ShareJsUpdateManager.getNewShareJsModel = sinon.stub().returns(@model)
			@ShareJsUpdateManager._listenForOps = sinon.stub()
			@ShareJsUpdateManager.removeDocFromCache = sinon.stub().callsArg(1)

		describe "successfully", ->
			beforeEach (done) ->
				@model.getSnapshot.callsArgWith(1, null, {snapshot: @updatedDocLines.join("\n"), v: @version})
				@model.db.appliedOps["#{@project_id}:#{@doc_id}"] = @appliedOps = ["mock-ops"]
				@ShareJsUpdateManager.applyUpdate @project_id, @doc_id, @update, @lines, @version, (err, docLines, version, appliedOps) =>
					@callback(err, docLines, version, appliedOps)
					done()

			it "should create a new ShareJs model", ->
				@ShareJsUpdateManager.getNewShareJsModel
					.calledWith(@project_id, @doc_id, @lines, @version)
					.should.equal true

			it "should listen for ops on the model", ->
				@ShareJsUpdateManager._listenForOps
