|
@@ -17,17 +17,19 @@ describe 'Project api controller', ->
|
|
|
@req =
|
|
@req =
|
|
|
params:
|
|
params:
|
|
|
project_id:@project_id
|
|
project_id:@project_id
|
|
|
|
|
+ session:
|
|
|
|
|
+ destroy:sinon.stub()
|
|
|
@res = {}
|
|
@res = {}
|
|
|
|
|
+ @projDetails = {name:"something"}
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "getProjectDetails", ->
|
|
describe "getProjectDetails", ->
|
|
|
|
|
|
|
|
it "should ask the project details handler for proj details", (done)->
|
|
it "should ask the project details handler for proj details", (done)->
|
|
|
- projDetails = {name:"something"}
|
|
|
|
|
- @ProjectDetailsHandler.getDetails.callsArgWith(1, null, projDetails)
|
|
|
|
|
|
|
+ @ProjectDetailsHandler.getDetails.callsArgWith(1, null, @projDetails)
|
|
|
@res.json = (data)=>
|
|
@res.json = (data)=>
|
|
|
@ProjectDetailsHandler.getDetails.calledWith(@project_id).should.equal true
|
|
@ProjectDetailsHandler.getDetails.calledWith(@project_id).should.equal true
|
|
|
- data.should.deep.equal projDetails
|
|
|
|
|
|
|
+ data.should.deep.equal @projDetails
|
|
|
done()
|
|
done()
|
|
|
@controller.getProjectDetails @req, @res
|
|
@controller.getProjectDetails @req, @res
|
|
|
|
|
|
|
@@ -37,4 +39,11 @@ describe 'Project api controller', ->
|
|
|
@res.send = (resCode)=>
|
|
@res.send = (resCode)=>
|
|
|
resCode.should.equal 500
|
|
resCode.should.equal 500
|
|
|
done()
|
|
done()
|
|
|
|
|
+ @controller.getProjectDetails @req, @res
|
|
|
|
|
+
|
|
|
|
|
+ it "should destroy the session", (done)->
|
|
|
|
|
+ @ProjectDetailsHandler.getDetails.callsArgWith(1, null, @projDetails)
|
|
|
|
|
+ @res.json = (data)=>
|
|
|
|
|
+ @req.session.destroy.called.should.equal true
|
|
|
|
|
+ done()
|
|
|
@controller.getProjectDetails @req, @res
|
|
@controller.getProjectDetails @req, @res
|