|
|
@@ -23,6 +23,7 @@ describe 'Project details handler', ->
|
|
|
getProject: sinon.stub().callsArgWith(2, null, @project)
|
|
|
@ProjectModel =
|
|
|
update: sinon.stub()
|
|
|
+ find: sinon.stub()
|
|
|
@UserGetter =
|
|
|
getUser: sinon.stub().callsArgWith(1, null, @user)
|
|
|
@tpdsUpdateSender =
|
|
|
@@ -54,6 +55,23 @@ describe 'Project details handler', ->
|
|
|
err.should.equal error
|
|
|
done()
|
|
|
|
|
|
+ describe "getProjectDescription", ->
|
|
|
+
|
|
|
+ it "should make a call to mongo just for the description", (done)->
|
|
|
+ @ProjectModel.find.callsArgWith(2)
|
|
|
+ @handler.getProjectDescription @project_id, (err, description)=>
|
|
|
+ @ProjectModel.find.calledWith({_id:@project_id}, "description").should.equal true
|
|
|
+ done()
|
|
|
+
|
|
|
+ it "should return what the mongo call returns", (done)->
|
|
|
+ err = "error"
|
|
|
+ description = "cool project"
|
|
|
+ @ProjectModel.find.callsArgWith(2, err, description)
|
|
|
+ @handler.getProjectDescription @project_id, (returnedErr, returnedDescription)=>
|
|
|
+ err.should.equal returnedErr
|
|
|
+ description.should.equal returnedDescription
|
|
|
+ done()
|
|
|
+
|
|
|
describe "setProjectDescription", ->
|
|
|
|
|
|
beforeEach ->
|
|
|
@@ -65,6 +83,8 @@ describe 'Project details handler', ->
|
|
|
@ProjectModel.update.calledWith({_id:@project_id}, {description:@description}).should.equal true
|
|
|
done()
|
|
|
|
|
|
+
|
|
|
+
|
|
|
describe "renameProject", ->
|
|
|
beforeEach ->
|
|
|
@ProjectModel.update.callsArgWith(2)
|