コード例 #1
0
ファイル: test.set-manager.js プロジェクト: Nerdmaster/ripple
 it("should call callback with insertRec's err and first record", function(done) {
   insertRec.yields("error", insertRecords);
   setUpdate.yields();
   SM.createQuestion(req, res, user, setID, function(err, record) {
     err.should.eql("error");
     record.should.eql(insertRecords[0]);
     done();
   });
 });
コード例 #2
0
ファイル: test.set-manager.js プロジェクト: Nerdmaster/ripple
 it("should call update on the sets collection to add the new question to the end of the questions list", function(done) {
   insertRec.yields(null, insertRecords);
   setUpdate.yields();
   SM.createQuestion(req, res, user, setID, function(err, record) {
     setUpdate.callCount.should.eql(1);
     var args = setUpdate.getCall(0).args;
     args[0].should.eql({_id: DB.getObjID(setID)});
     args[1].should.eql({ $push: {question: insertRecords[0]._id} });
     done();
   });
 });
コード例 #3
0
ファイル: test.set-manager.js プロジェクト: Nerdmaster/ripple
 it("should call insertRec to create a new question", function(done) {
   insertRec.yields(null, insertRecords);
   setUpdate.yields();
   SM.createQuestion(req, res, user, setID, function(err, record) {
     insertRec.callCount.should.eql(1);
     var args = insertRec.getCall(0).args;
     args[0].should.eql(SM.questions);
     args[1].should.eql({type: "qtype", authorID: "user-id", setID: DB.getObjID(setID)});
     done();
   });
 });
コード例 #4
0
ファイル: routes.js プロジェクト: arthurJoly/mfe-services
app.post('/question/create', function(request, response) {
	feed.createQuestion(request,response);
})