Fix broken argument signature of addFolder

This commit is contained in:
James Allen 2014-10-16 11:26:57 +01:00
parent 9f1a7c7396
commit 46ecaf9f6c
4 changed files with 8 additions and 8 deletions

View file

@ -184,9 +184,9 @@ module.exports = EditorController =
replaceFile: (project_id, file_id, fsPath, source, callback = (error) ->)->
ProjectEntityHandler.replaceFile project_id, file_id, fsPath, callback
addFolder: (project_id, folder_id, folderName, callback = (error, folder)->)->
addFolder: (project_id, folder_id, folderName, source, callback = (error, folder)->)->
folderName = folderName.trim()
logger.log {project_id, folder_id, folderName}, "sending new folder to project"
logger.log {project_id, folder_id, folderName, source}, "sending new folder to project"
Metrics.inc "editor.add-folder"
ProjectEntityHandler.addFolder project_id, folder_id, folderName, (err, folder, folder_id)=>
@p.notifyProjectUsersOfNewFolder project_id, folder_id, folder, (error) ->

View file

@ -33,7 +33,7 @@ module.exports = EditorHttpController =
project_id = req.params.Project_id
name = req.body.name
parent_folder_id = req.body.parent_folder_id
EditorController.addFolder project_id, parent_folder_id, name, (error, doc) ->
EditorController.addFolder project_id, parent_folder_id, name, "editor", (error, doc) ->
return next(error) if error?
res.json doc

View file

@ -526,7 +526,7 @@ describe "EditorController", ->
it 'should add the folder using the project entity handler', (done)->
mock = sinon.mock(@ProjectEntityHandler).expects("addFolder").withArgs(@project_id, @folder_id, @folderName).callsArg(3)
@EditorController.addFolder @project_id, @folder_id, @folderName, ->
@EditorController.addFolder @project_id, @folder_id, @folderName, @source, ->
mock.verify()
done()
@ -534,7 +534,7 @@ describe "EditorController", ->
@ProjectEntityHandler.addFolder = (project_id, folder_id, folderName, callback)=> callback(null, @folder, @folder_id)
mock = sinon.mock(@EditorController.p).expects('notifyProjectUsersOfNewFolder').withArgs(@project_id, @folder_id, @folder).callsArg(3)
@EditorController.addFolder @project_id, @folder_id, @folderName, ->
@EditorController.addFolder @project_id, @folder_id, @folderName, @source, ->
mock.verify()
done()
@ -547,7 +547,7 @@ describe "EditorController", ->
it 'should return the folder in the callback', (done) ->
@ProjectEntityHandler.addFolder = (project_id, folder_id, folderName, callback)=> callback(null, @folder, @folder_id)
@EditorController.addFolder @project_id, @folder_id, @folderName, (error, folder) =>
@EditorController.addFolder @project_id, @folder_id, @folderName, @source, (error, folder) =>
folder.should.equal @folder
done()

View file

@ -76,12 +76,12 @@ describe "EditorHttpController", ->
@req.body =
name: @name = "folder-name"
parent_folder_id: @parent_folder_id
@EditorController.addFolder = sinon.stub().callsArgWith(3, null, @folder)
@EditorController.addFolder = sinon.stub().callsArgWith(4, null, @folder)
@EditorHttpController.addFolder @req, @res
it "should call EditorController.addFolder", ->
@EditorController.addFolder
.calledWith(@project_id, @parent_folder_id, @name)
.calledWith(@project_id, @parent_folder_id, @name, "editor")
.should.equal true
it "should send the folder back as JSON", ->