|
|
@@ -23,7 +23,7 @@ describe 'Project details handler', ->
|
|
|
getProject: sinon.stub().callsArgWith(2, null, @project)
|
|
|
@ProjectModel =
|
|
|
update: sinon.stub()
|
|
|
- find: sinon.stub()
|
|
|
+ findOne: sinon.stub()
|
|
|
@UserGetter =
|
|
|
getUser: sinon.stub().callsArgWith(1, null, @user)
|
|
|
@tpdsUpdateSender =
|
|
|
@@ -58,15 +58,15 @@ describe 'Project details handler', ->
|
|
|
describe "getProjectDescription", ->
|
|
|
|
|
|
it "should make a call to mongo just for the description", (done)->
|
|
|
- @ProjectModel.find.callsArgWith(2)
|
|
|
+ @ProjectModel.findOne.callsArgWith(2)
|
|
|
@handler.getProjectDescription @project_id, (err, description)=>
|
|
|
- @ProjectModel.find.calledWith({_id:@project_id}, "description").should.equal true
|
|
|
+ @ProjectModel.findOne.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)
|
|
|
+ @ProjectModel.findOne.callsArgWith(2, err, {description:description})
|
|
|
@handler.getProjectDescription @project_id, (returnedErr, returnedDescription)=>
|
|
|
err.should.equal returnedErr
|
|
|
description.should.equal returnedDescription
|