Only ignore hidden files from Dropbox, not GitHub

This commit is contained in:
James Allen
2014-10-27 14:39:20 +00:00
parent f4be1884d3
commit f1ddff4061
5 changed files with 33 additions and 28 deletions
@@ -17,6 +17,8 @@ describe 'TpdsUpdateHandler', ->
createBlankProject : sinon.stub().callsArgWith(2, null, @project)
@projectDeleter = {markAsDeletedByExternalSource:sinon.stub().callsArgWith(1)}
@rootDocManager = setRootDocAutomatically:sinon.stub()
@FileTypeManager =
shouldIgnore: sinon.stub().callsArgWith(1, null, false)
@handler = SandboxedModule.require modulePath, requires:
'./UpdateMerger': @updateMerger
'./Editor/EditorController': @editorController
@@ -24,6 +26,7 @@ describe 'TpdsUpdateHandler', ->
'../Project/ProjectCreationHandler':@projectCreationHandler
'../Project/ProjectDeleter': @projectDeleter
"../Project/ProjectRootDocManager" : @rootDocManager
'../Uploads/FileTypeManager': @FileTypeManager
'logger-sharelatex': log:->
@user_id = "dsad29jlkjas"
@source = "dropbox"
@@ -55,7 +58,14 @@ describe 'TpdsUpdateHandler', ->
done()
), 1
it 'should not update files that should be ignored', (done) ->
@FileTypeManager.shouldIgnore = sinon.stub().callsArgWith(1, null, true)
@projectLocator.findUsersProjectByName = sinon.stub().callsArgWith(2)
path = "/.gitignore"
@updateMerger.mergeUpdate = sinon.stub()
@handler.newUpdate @user_id, @project.name, path, {}, @source, =>
@updateMerger.mergeUpdate.called.should.equal false
done()
describe 'getting a delete :', ->
it 'should call deleteEntity in the collaberation manager', (done)->
@@ -33,33 +33,17 @@ describe 'UpdateMerger :', ->
@fsPath = "file/system/path.tex"
@updateMerger.p.writeStreamToDisk = sinon.stub().callsArgWith(3, null, @fsPath)
@FileTypeManager.isBinary = sinon.stub()
@FileTypeManager.shouldIgnore = sinon.stub()
it 'should get the element id', (done)->
@projectLocator.findElementByPath = sinon.spy()
@updateMerger.mergeUpdate @project_id, @path, @update, @source, =>
@projectLocator.findElementByPath.calledWith(@project_id, @path).should.equal true
done()
it 'should ignore update if FileTypeManger says ignore', (done)->
filePath = ".gitignore"
@projectLocator.findElementByPath = (_, __, cb)->cb(null, {_id:"id"})
@FileTypeManager.shouldIgnore.callsArgWith(1, null, true)
@updateMerger.mergeUpdate @project_id, filePath, @update, @source, =>
@FileTypeManager.isBinary.called.should.equal false
@FileTypeManager.shouldIgnore.calledWith(filePath).should.equal true
done()
it 'should process update as doc when it is a doc', (done)->
doc_id = "231312s"
@FileTypeManager.isBinary.callsArgWith(2, null, false)
@projectLocator.findElementByPath = (_, __, cb)->cb(null, {_id:doc_id})
@FileTypeManager.shouldIgnore.callsArgWith(1, null, false)
@updateMerger.p.processDoc = sinon.stub().callsArgWith(5)
filePath = "/folder/doc.tex"
@@ -72,7 +56,6 @@ describe 'UpdateMerger :', ->
file_id = "1231"
@projectLocator.findElementByPath = (_, __, cb)->cb(null, {_id:file_id})
@FileTypeManager.isBinary.callsArgWith(2, null, true)
@FileTypeManager.shouldIgnore.callsArgWith(1, null, false)
@updateMerger.p.processFile = sinon.stub().callsArgWith(5)
filePath = "/folder/file1.png"