Example #1
0
 it("should send an error", function() {
   var send = sinon.stub(res, "send");
   SM.createSet(req, res, o);
   send.callCount.should.eql(1);
   send.withArgs(err, 400).callCount.should.eql(1);
 });
Example #2
0
 it("should set the questionSet session data", function() {
   SM.createSet(req, res, o);
   req.session.questionSet.should.eql({id: "set-id"});
 });
Example #3
0
 it("should redirect to the set's edit page", function() {
   var redirect = sinon.stub(res, "redirect");
   SM.createSet(req, res, o);
   redirect.callCount.should.eql(1);
   redirect.withArgs("admin/set/edit/set-id~set name").callCount.should.eql(1);
 });
Example #4
0
 it("should call insertRec with form data", function() {
   SM.createSet(req, res, o);
   insertRec.withArgs(SM.sets, {name: "set name", class: "Foo 101", authorID: "user id"}, sinon.match.func).callCount.should.eql(1);
 });