|
@@ -18,8 +18,9 @@ describe "ProjectController", ->
|
|
|
url:"chat.com"
|
|
url:"chat.com"
|
|
|
siteUrl: "mysite.com"
|
|
siteUrl: "mysite.com"
|
|
|
@ProjectDeleter =
|
|
@ProjectDeleter =
|
|
|
- archiveProject: sinon.stub().callsArgWith(1)
|
|
|
|
|
- restoreProject: sinon.stub().callsArgWith(1)
|
|
|
|
|
|
|
+ archiveProject: sinon.stub().callsArg(1)
|
|
|
|
|
+ deleteProject: sinon.stub().callsArg(1)
|
|
|
|
|
+ restoreProject: sinon.stub().callsArg(1)
|
|
|
findArchivedProjects: sinon.stub()
|
|
findArchivedProjects: sinon.stub()
|
|
|
@ProjectDuplicator =
|
|
@ProjectDuplicator =
|
|
|
duplicate: sinon.stub().callsArgWith(3, null, {_id:@project_id})
|
|
duplicate: sinon.stub().callsArgWith(3, null, {_id:@project_id})
|
|
@@ -70,13 +71,21 @@ describe "ProjectController", ->
|
|
|
jsPath:"js path here"
|
|
jsPath:"js path here"
|
|
|
|
|
|
|
|
describe "deleteProject", ->
|
|
describe "deleteProject", ->
|
|
|
- it "should tell the project deleter", (done)->
|
|
|
|
|
|
|
+ it "should tell the project deleter to archive when forever=false", (done)->
|
|
|
@res.send = (code)=>
|
|
@res.send = (code)=>
|
|
|
@ProjectDeleter.archiveProject.calledWith(@project_id).should.equal true
|
|
@ProjectDeleter.archiveProject.calledWith(@project_id).should.equal true
|
|
|
code.should.equal 200
|
|
code.should.equal 200
|
|
|
done()
|
|
done()
|
|
|
@ProjectController.deleteProject @req, @res
|
|
@ProjectController.deleteProject @req, @res
|
|
|
|
|
|
|
|
|
|
+ it "should tell the project deleter to delete when forever=true", (done)->
|
|
|
|
|
+ @req.query = forever: "true"
|
|
|
|
|
+ @res.send = (code)=>
|
|
|
|
|
+ @ProjectDeleter.deleteProject.calledWith(@project_id).should.equal true
|
|
|
|
|
+ code.should.equal 200
|
|
|
|
|
+ done()
|
|
|
|
|
+ @ProjectController.deleteProject @req, @res
|
|
|
|
|
+
|
|
|
describe "restoreProject", ->
|
|
describe "restoreProject", ->
|
|
|
it "should tell the project deleter", (done)->
|
|
it "should tell the project deleter", (done)->
|
|
|
@res.send = (code)=>
|
|
@res.send = (code)=>
|