mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 01:30:36 +00:00
Test cleanup
This commit is contained in:
@@ -547,4 +547,6 @@ module.exports = function (grunt) {
|
||||
'test',
|
||||
'build'
|
||||
]);
|
||||
|
||||
grunt.loadNpmTasks('grunt-mocha-debug');
|
||||
};
|
||||
|
||||
@@ -12,11 +12,10 @@ var PromotionSchema = new Schema({
|
||||
|
||||
/* Indexes */
|
||||
PromotionSchema.index({title: 1, user: 1}, {unique: true});
|
||||
var _model = mongoose.model('Promotion', PromotionSchema);
|
||||
|
||||
/* Operations */
|
||||
PromotionSchema.statics.findByTitle = function(title, cb){
|
||||
console.log("findByTitle: " + title);
|
||||
_model.findOne({title: title}, cb);
|
||||
this.findOne({title: title}, cb);
|
||||
};
|
||||
|
||||
mongoose.model('Promotion', PromotionSchema);
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
"open": "~0.0.4",
|
||||
"mocha": "~1.18.2",
|
||||
"mongodb": "~1.3.23",
|
||||
"mocha-mongoose": "~1.0.1"
|
||||
"mocha-mongoose": "~1.0.1",
|
||||
"grunt-mocha-debug": "0.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
||||
@@ -75,6 +75,7 @@ describe('Promotion Model', function() {
|
||||
});
|
||||
describe('Search methods', function(){
|
||||
it('should find promotion by title', function(done){
|
||||
debugger;
|
||||
Promotion.findByTitle('Test Prom 1', function(result){
|
||||
should.exist(result);
|
||||
result.title.should.equal('Test Prom 1');
|
||||
|
||||
Reference in New Issue
Block a user