This commit is contained in:
Henry Oswald 2015-08-13 22:51:05 +01:00
commit 68e970cd69
2 changed files with 10 additions and 9 deletions

View file

@ -30,7 +30,7 @@
"lynx": "0.1.1", "lynx": "0.1.1",
"marked": "^0.3.3", "marked": "^0.3.3",
"method-override": "^2.3.3", "method-override": "^2.3.3",
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#0966b75a646720781c6accdca15832e675d7d3f2", "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.2.0",
"mimelib": "0.2.14", "mimelib": "0.2.14",
"mocha": "1.17.1", "mocha": "1.17.1",
"mongojs": "0.18.2", "mongojs": "0.18.2",

View file

@ -13,6 +13,7 @@ describe "InactiveProjectManager", ->
@settings = {} @settings = {}
@DocstoreManager = @DocstoreManager =
unarchiveProject:sinon.stub() unarchiveProject:sinon.stub()
archiveProject:sinon.stub()
@ProjectUpdateHandler = @ProjectUpdateHandler =
markAsActive:sinon.stub() markAsActive:sinon.stub()
markAsInactive:sinon.stub() markAsInactive:sinon.stub()
@ -66,20 +67,20 @@ describe "InactiveProjectManager", ->
beforeEach -> beforeEach ->
it "should call unarchiveProject and markAsInactive", (done)-> it "should call unarchiveProject and markAsInactive", (done)->
@DocstoreManager.unarchiveProject.callsArgWith(1) @DocstoreManager.archiveProject.callsArgWith(1)
@ProjectUpdateHandler.markAsInactive.callsArgWith(1) @ProjectUpdateHandler.markAsInactive.callsArgWith(1)
@InactiveProjectManager.deactivateProject @project_id, (err)-> @InactiveProjectManager.deactivateProject @project_id, (err)=>
@DocstoreManager.unarchiveProject.calledWith(@project_id).should.equal true @DocstoreManager.archiveProject.calledWith(@project_id).should.equal true
@ProjectUpdateHandler.markAsInactive.callsArgWith(@project_id).should.equal true @ProjectUpdateHandler.markAsInactive.calledWith(@project_id).should.equal true
done() done()
it "should not call markAsInactive if there was a problem unarchiving", (done)-> it "should not call markAsInactive if there was a problem unarchiving", (done)->
@DocstoreManager.unarchiveProject.callsArgWith(1, "errorrr") @DocstoreManager.archiveProject.callsArgWith(1, "errorrr")
@ProjectUpdateHandler.markAsInactive.callsArgWith(1) @ProjectUpdateHandler.markAsInactive.callsArgWith(1)
@InactiveProjectManager.deactivateProject @project_id, (err)-> @InactiveProjectManager.deactivateProject @project_id, (err)=>
err.should.equal "errorrr" err.should.equal "errorrr"
@DocstoreManager.unarchiveProject.calledWith(@project_id).should.equal true @DocstoreManager.archiveProject.calledWith(@project_id).should.equal true
@ProjectUpdateHandler.markAsInactive.callsArgWith(@project_id).should.equal false @ProjectUpdateHandler.markAsInactive.calledWith(@project_id).should.equal false
done() done()